﻿using DevExpress.Data.Filtering;
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using Newtonsoft.Json;
using MIMDesignShaft.Model;
using System.Configuration;
using Newtonsoft.Json.Linq;

namespace MIMDesignShaft
{

    public partial class Form1 : DevExpress.XtraBars.ToolbarForm.ToolbarForm
    {
        string userName = null;
        float x, y;
        string message = null;
        readonly string WellBuiltUrl = ConfigurationManager.ConnectionStrings["WellBuiltUrl"].ConnectionString;

        public Form1()
        {
            InitializeComponent();
        }

        public Form1(string userName)
        {
            InitializeComponent();
            this.userName = userName;
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            //平台板计算_表格初始化
            initTable();
            this.userBarStaticItem.Caption = userName;
            x = this.Width;
            y = this.Height;
        }

        #region 参数保存及提示

        #endregion

        #region 井巷断面及支护
        //用户改变断面类型时，修改拱形，修改示意图片，重新计算断面参数
        private void PH_DM_comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (PH_DM_comboBoxEdit1.Text == "三心拱")
            {
                PH_DM_comboBoxEdit2.Properties.Items.Clear();
                PH_DM_comboBoxEdit2.Properties.Items.Add("3");
                PH_DM_comboBoxEdit2.Properties.Items.Add("4");
                PH_DM_comboBoxEdit2.Properties.Items.Add("5");
                PH_DM_comboBoxEdit2.Text = "3";
                PH_pictureBox1.Image = MIMDesignShaft.Properties.Resources._3;
            }
            else if (PH_DM_comboBoxEdit1.Text == "半圆拱")
            {
                PH_DM_comboBoxEdit2.Properties.Items.Clear();
                PH_DM_comboBoxEdit2.Properties.Items.Add("2");
                PH_DM_comboBoxEdit2.Text = "2";
                PH_pictureBox1.Image = MIMDesignShaft.Properties.Resources._2;
            }
            else if (PH_DM_comboBoxEdit1.Text == "圆弧拱")
            {
                PH_DM_comboBoxEdit2.Properties.Items.Clear();
                PH_DM_comboBoxEdit2.Properties.Items.Add("3");
                PH_DM_comboBoxEdit2.Properties.Items.Add("4");
                PH_DM_comboBoxEdit2.Properties.Items.Add("5");
                PH_DM_comboBoxEdit2.Properties.Items.Add("6");
                PH_DM_comboBoxEdit2.Properties.Items.Add("7");
                PH_DM_comboBoxEdit2.Text = "4";
                PH_pictureBox1.Image = MIMDesignShaft.Properties.Resources._1;
            }
            TunnelSectionSetValues();
        }

        //用户选择的支护类型改变时，调整tab页显示的内容，重新计算断面支护
        private void PH_DM_comboBoxEdit3_SelectedIndexChanged(object sender, EventArgs e)
        {
            string zhihu_type = PH_DM_comboBoxEdit3.Text;
            for (int i = 0; i < PH_JG_TabControl.TabPages.Count; i++)
            {
                PH_JG_TabControl.TabPages[i].PageVisible = false;
            }
            switch (zhihu_type)
            {
                case "素混凝土":
                    PH_JG_TabControl.TabPages[0].PageVisible = true;
                    break;
                case "钢筋砼":
                    PH_JG_TabControl.TabPages[1].PageVisible = true;
                    break;
                case "喷锚网":
                    PH_JG_TabControl.TabPages[2].PageVisible = true;
                    break;
                case "钢拱架":
                    PH_JG_TabControl.TabPages[3].PageVisible = true;
                    break;
                case "拱架管棚":
                    //PH_JG_TabControl.TabPages[3].PageVisible = true;
                    PH_JG_TabControl.TabPages[4].PageVisible = true;
                    break;
            }
            TunnelSectionSetValues();
        }

        //输入的支护参数改变时，重新计算支护数据
        private void InputSupportValueChanged(object sender, EventArgs e)
        {
            TunnelSectionSetValues();
        }

        //钢拱架支护类型改变时，修改支架选型
        private void PH_JG_comboBoxEdit11_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (PH_JG_comboBoxEdit11.Text)
            {
                case "U":
                    labelControl217.Text = "U型钢";
                    PH_JG_comboBoxEdit14.Properties.Items.Clear();
                    PH_JG_comboBoxEdit14.Properties.Items.Add("18UY");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("25UY");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("25U");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("29U");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("36U");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("40U");
                    PH_JG_comboBoxEdit14.Text = "18UY";
                    break;
                case "C":
                    labelControl217.Text = "槽钢";
                    PH_JG_comboBoxEdit14.Properties.Items.Clear();
                    PH_JG_comboBoxEdit14.Properties.Items.Add("C14b");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("C16b");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("C18b");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("C20b");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("C22b");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("C24b");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("C25b");
                    PH_JG_comboBoxEdit14.Text = "C14b";
                    break;
                case "I":
                    labelControl217.Text = "工字钢";
                    PH_JG_comboBoxEdit14.Properties.Items.Clear();
                    PH_JG_comboBoxEdit14.Properties.Items.Add("I12.6");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("I14");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("I16");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("I18");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("I20b");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("I22b");
                    PH_JG_comboBoxEdit14.Properties.Items.Add("I24b");
                    PH_JG_comboBoxEdit14.Text = "I22b";
                    break;
            }
            TunnelSectionSetValues();
        }
        private void TunnelSectionSetValues()
        {
            //测试调用webapi
            //url需要放到配置文件中
            //string url = "http://192.168.100.77:8012/api/WellBuilt/TunnelSectionAction";

            TunnelSectionIn sectionIn = new TunnelSectionIn();
            #region 将控件内容传入实体类
            sectionIn.SectionType = PH_DM_comboBoxEdit1.Text;//断面类型
            sectionIn.Arch = double.Parse(PH_DM_comboBoxEdit2.Text);//拱形
            sectionIn.ClearWidth = double.Parse(PH_DM_spinEdit1.Text);//巷道宽度
            sectionIn.ClearHeight = double.Parse(PH_DM_spinEdit2.Text);//巷道高度
            sectionIn.CrossSection = double.Parse(PH_DM_spinEdit3.Text);//断面支护厚度
            sectionIn.BackPlane = double.Parse(PH_DM_spinEdit4.Text);//底板支护厚度
            sectionIn.SupportType = PH_DM_comboBoxEdit3.Text;//支护类型

            sectionIn.ZJ_Diameter = double.Parse(PH_JG_comboBoxEdit1.Text);
            sectionIn.ZJ_Spacing = double.Parse(PH_JG_comboBoxEdit2.Text);
            sectionIn.FJ_Diameter = double.Parse(PH_JG_comboBoxEdit3.Text);
            sectionIn.FJ_Spacing = double.Parse(PH_JG_comboBoxEdit4.Text);
            sectionIn.GaugeLength = double.Parse(PH_JG_spinEdit1.Text);
            sectionIn.Monolayer = (PH_JG_radioButton1.Checked == true) ? true : false;
            sectionIn.JSW_Diameter = double.Parse(PH_JG_comboBoxEdit5.Text);
            sectionIn.JSW_Wd = double.Parse(PH_JG_comboBoxEdit6.Text);
            sectionIn.TB_Side = double.Parse(PH_JG_comboBoxEdit7.Text);
            sectionIn.TB_Pallet = double.Parse(PH_JG_comboBoxEdit8.Text);
            sectionIn.MGL_Diameter = double.Parse(PH_JG_comboBoxEdit9.Text);
            sectionIn.MGL_Length = double.Parse(PH_JG_comboBoxEdit10.Text);
            sectionIn.StentType = PH_JG_comboBoxEdit11.Text;
            sectionIn.SupportSpacing = double.Parse(PH_JG_spinEdit2.Text);
            sectionIn.GB_Thickness = double.Parse(PH_JG_comboBoxEdit12.Text);
            sectionIn.GB_Standard = double.Parse(PH_JG_spinEdit3.Text);
            sectionIn.GB_Number = double.Parse(PH_JG_comboBoxEdit13.Text);
            sectionIn.LG_Diameter = double.Parse(PH_JG_spinEdit4.Text);
            sectionIn.LG_Spacing = double.Parse(PH_JG_spinEdit5.Text);
            sectionIn.USteel = PH_JG_comboBoxEdit14.Text;
            sectionIn.GP_Diameter = double.Parse(PH_JG_spinEdit6.Text);
            sectionIn.GP_WallThickness = double.Parse(PH_JG_spinEdit7.Text);
            sectionIn.GP_Length = double.Parse(PH_JG_spinEdit8.Text);
            sectionIn.GP_Spacing = double.Parse(PH_JG_spinEdit9.Text);
            #endregion
            try
            {
                //通过http请求获取接口中传出参数
                string sectionOutStr = HttpRequest.ResultData(sectionIn, WellBuiltUrl + "TunnelSectionAction",out message);
                if (!string.IsNullOrEmpty(message))
                {
                    MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //将异常信息清空
                    message = null;
                    return;
                }
                //json转换为实体类
                TunnelSectionOut sectionOut = JsonConvert.DeserializeObject<TunnelSectionOut>(sectionOutStr);
                #region 实体类给控件赋值
                PH_DM_label12.Text = sectionOut.AmountOfCrown.ToString("#0.000");
                PH_DM_label37.Text = sectionOut.StraightWallHeight.ToString("#0.000");
                PH_DM_label16.Text = sectionOut.XH_R.ToString("#0.000");
                PH_DM_label18.Text = sectionOut.XH_A.ToString("#0.000");
                PH_DM_label20.Text = sectionOut.XH_Arc.ToString("#0.000");
                PH_DM_label23.Text = sectionOut.DH_R.ToString("#0.000");
                PH_DM_label25.Text = sectionOut.DH_B.ToString("#0.000");
                PH_DM_label27.Text = sectionOut.DH_Arc.ToString("#0.000");
                PH_DM_label30.Text = sectionOut.NetSection.ToString("#0.000");
                PH_DM_label32.Text = sectionOut.Section.ToString("#0.000");
                PH_DM_label34.Text = sectionOut.SectionPerimeter.ToString("#0.000");
                PH_DM_label36.Text = sectionOut.ZHT_Height.ToString("#0.000");
                PH_JG_Result_label1.Text = $"{sectionOut.ConcreteAmount.ToString("#0.000")}m³";
                PH_JG_Result_label2.Text = sectionOut.ZJ_Length.ToString("#0.000");
                //钢筋砼
                PH_JG_Result_label3.Text = sectionOut.FJ_Radical.ToString("#0.000");
                PH_JG_Result_label4.Text = sectionOut.DCPJ_Weight.ToString("#0.000");
                PH_JG_Result_label5.Text = sectionOut.HNTPJ_Length.ToString("#0.000");
                PH_JG_Result_label6.Text = sectionOut.HNTPJ_Weight.ToString("#0.000");
                //喷锚网
                PH_JG_Result_label7.Text = sectionOut.JSW_Area.ToString("#0.000");
                PH_JG_Result_label8.Text = sectionOut.JSW_Weight.ToString("#0.000");
                PH_JG_Result_label9.Text = sectionOut.TB_Weighyt.ToString("#0.000");
                PH_JG_Result_label10.Text = sectionOut.MGL_Number.ToString("#0.000");
                PH_JG_Result_label11.Text = sectionOut.MGL_Weight.ToString("#0.000");
                //钢拱架
                PH_JG_Result_label12.Text = sectionOut.GB_Weight.ToString("#0.000");
                PH_JG_Result_label13.Text = sectionOut.LG_Weight.ToString("#0.000");
                PH_JG_Result_label14.Text = sectionOut.ZJ_PieceWeight.ToString("#0.000");
                PH_JG_Result_label15.Text = sectionOut.ZJ_TotalWeight.ToString("#0.000");
                //拱架管棚
                PH_JG_Result_label16.Text = sectionOut.GZ_Weight.ToString("#0.000");
                PH_JG_Result_label17.Text = sectionOut.GP_Weight.ToString("#0.000");
                #endregion

                #region 为控件标签赋值
                PH_DM_label12.ToolTip = sectionOut.AmountOfCrown.ToString();
                PH_DM_label37.ToolTip = sectionOut.StraightWallHeight.ToString();
                PH_DM_label16.ToolTip = sectionOut.XH_R.ToString();
                PH_DM_label18.ToolTip = sectionOut.XH_A.ToString();
                PH_DM_label20.ToolTip = sectionOut.XH_Arc.ToString();
                PH_DM_label23.ToolTip = sectionOut.DH_R.ToString();
                PH_DM_label25.ToolTip = sectionOut.DH_B.ToString();
                PH_DM_label27.ToolTip = sectionOut.DH_Arc.ToString();
                PH_DM_label30.ToolTip = sectionOut.NetSection.ToString();
                PH_DM_label32.ToolTip = sectionOut.Section.ToString();
                PH_DM_label34.ToolTip = sectionOut.SectionPerimeter.ToString();
                PH_DM_label36.ToolTip = sectionOut.ZHT_Height.ToString();
                PH_JG_Result_label1.ToolTip = sectionOut.ConcreteAmount.ToString();
                PH_JG_Result_label2.ToolTip = sectionOut.ZJ_Length.ToString();
                PH_JG_Result_label3.ToolTip = sectionOut.FJ_Radical.ToString();
                PH_JG_Result_label4.ToolTip = sectionOut.DCPJ_Weight.ToString();
                PH_JG_Result_label5.ToolTip = sectionOut.HNTPJ_Length.ToString();
                PH_JG_Result_label6.ToolTip = sectionOut.HNTPJ_Weight.ToString();
                PH_JG_Result_label7.ToolTip = sectionOut.JSW_Area.ToString();
                PH_JG_Result_label8.ToolTip = sectionOut.JSW_Weight.ToString();
                PH_JG_Result_label9.ToolTip = sectionOut.TB_Weighyt.ToString();
                PH_JG_Result_label10.ToolTip = sectionOut.MGL_Number.ToString();
                PH_JG_Result_label11.ToolTip = sectionOut.MGL_Weight.ToString();
                PH_JG_Result_label12.ToolTip = sectionOut.GB_Weight.ToString();
                PH_JG_Result_label13.ToolTip = sectionOut.LG_Weight.ToString();
                PH_JG_Result_label14.ToolTip = sectionOut.ZJ_PieceWeight.ToString();
                PH_JG_Result_label15.ToolTip = sectionOut.ZJ_TotalWeight.ToString();
                PH_JG_Result_label16.ToolTip = sectionOut.GZ_Weight.ToString();
                PH_JG_Result_label17.ToolTip = sectionOut.GP_Weight.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            #endregion
        }

        #endregion

        #region 锚杆设计计算

        //输入参数：岩石类别
        private void ComboBoxEdit3_SelectedIndexChanged(object sender, EventArgs e)
        {
            string rockType = comboBoxEdit3.Text;
            if (rockType == "坚硬岩")
            {
                labelControl8.Text = "1.5~2.5";
                spinEdit3.Text = "1.6";
            }
            else if (rockType == "较硬岩")
            {
                labelControl8.Text = "1.0~1.5";
                spinEdit3.Text = "1.1";
            }
            else if (rockType == "软岩")
            {
                labelControl8.Text = "0.6~1.2";
                spinEdit3.Text = "0.7";
            }
            else if (rockType == "极软岩")
            {
                labelControl8.Text = "0.6~1.0";
                spinEdit3.Text = "0.6";
            }
            else
                labelControl8.Text = "";

            popupContainerEdit1.Text = comboBoxEdit3.Text + ", 取值" + spinEdit3.Text;
        }
        //输入参数：注浆体与围岩的极限粘结强度标准值
        private void SpinEdit3_EditValueChanged(object sender, EventArgs e)
        {
            popupContainerEdit1.Text = comboBoxEdit3.Text + ", 取值" + spinEdit3.Text;
        }
        ////输入参数：锚固段长度
        private void ComboBoxEdit4_SelectedIndexChanged(object sender, EventArgs e)
        {
            string Length = comboBoxEdit4.Text;

            if (Length == "9~12")
            {
                labelControl127.Text = "0.8~0.6";
                spinEdit29.Text = "0.6";
            }
            else if (Length == "6~9")
            {
                labelControl127.Text = "1.0~0.8";
                spinEdit29.Text = "0.8";
            }
            else if (Length == "6")
            {
                labelControl127.Text = "1.0";
                spinEdit29.Text = "1.0";
            }
            else if (Length == "6~3")
            {
                labelControl127.Text = "1.0~1.3";
                spinEdit29.Text = "1.0";
            }
            else if (Length == "3~2")
            {
                labelControl127.Text = "1.3~1.6";
                spinEdit29.Text = "1.3";
            }
            else
                labelControl127.Text = "";

            popupContainerEdit2.Text = "锚固段长度:" + comboBoxEdit4.Text + ", 取值" + spinEdit29.Text;
        }
        //输入参数：锚固段长度对粘结强度的影响系数
        private void SpinEdit29_EditValueChanged(object sender, EventArgs e)
        {
            popupContainerEdit2.Text = "锚固段长度:" + comboBoxEdit4.Text + ", 取值" + spinEdit29.Text;
        }

        //输入参数：水泥砂浆强度
        private void ComboBoxEdit2_SelectedIndexChanged(object sender, EventArgs e)
        {
            string intensity = comboBoxEdit2.Text;

            if (intensity == "25")
            {
                labelControl26.Text = "0.8";
                spinEdit9.Text = "0.8";
            }
            else if (intensity == "30")
            {
                labelControl26.Text = "0.9";
                spinEdit9.Text = "0.9";
            }
            else if (intensity == "40")
            {
                labelControl26.Text = "1.0";
                spinEdit9.Text = "1.0";
            }
            else
            {
                labelControl26.Text = "";
                spinEdit9.Text = "0.8";
            }

            popupContainerEdit5.Text = "砂浆强度" + comboBoxEdit2.Text + "MPa, 取值" + spinEdit9.Text;
        }
        //输入参数：砂浆注浆体与杆体间粘结强度设计值
        private void SpinEdit9_EditValueChanged(object sender, EventArgs e)
        {
            popupContainerEdit5.Text = "砂浆强度" + comboBoxEdit2.Text + "MPa, 取值" + spinEdit9.Text;
        }

        //输入参数：钢筋或钢绞线根数
        private void SpinEdit6_EditValueChanged(object sender, EventArgs e)
        {
            string number = spinEdit6.Text;

            if (number == "1")
            {
                labelControl22.Text = "1";
                spinEdit7.Text = "1";
            }

            else
            {
                labelControl22.Text = "0.70~0.85";
                spinEdit7.Text = "0.80";
            }

            popupContainerEdit4.Text = "根数:" + spinEdit6.Text + ", 界面粘结强度降低系数ξ取值" + spinEdit7.Text;
        }
        //输入参数：界面粘结强度降低系数ξ
        private void SpinEdit7_EditValueChanged(object sender, EventArgs e)
        {
            popupContainerEdit4.Text = "根数:" + spinEdit6.Text + ", 界面粘结强度降低系数ξ取值" + spinEdit7.Text;
        }

        //输入参数：安全等级
        private void ComboBoxEdit5_SelectedIndexChanged(object sender, EventArgs e)
        {
            string level = comboBoxEdit5.Text;
            if (level == "Ⅰ")
            {
                labelControl16.Text = "危害大";
                spinEdit5.Text = "2.2";
            }
            else if (level == "Ⅱ")
            {
                labelControl16.Text = "危害较大";
                spinEdit5.Text = "2";
            }
            else if (level == "Ⅲ")
            {
                labelControl16.Text = "危害较轻";
                spinEdit5.Text = "2";
            }
            else
            {
                labelControl16.Text = "";
                spinEdit5.Text = "2";
            }

            popupContainerEdit3.Text = "安全等级" + comboBoxEdit5.Text + ", 取值" + spinEdit5.Text;
        }
        //输入参数：安全系数
        private void SpinEdit5_EditValueChanged(object sender, EventArgs e)
        {
            popupContainerEdit3.Text = "安全等级" + comboBoxEdit5.Text + ", 取值" + spinEdit5.Text;
        }
        //输入参数：钢筋或钢绞线根数
        private void ComboBoxEdit25_SelectedIndexChanged(object sender, EventArgs e)
        {
            string number = comboBoxEdit25.Text;

            if (number == "1")
            {
                labelControl236.Text = "1";
                spinEdit43.Text = "1";
            }

            else
            {
                labelControl236.Text = "0.75";
                spinEdit43.Text = "0.80";
            }

            popupContainerEdit4.Text = "根数:" + comboBoxEdit25.Text + ", 界面粘结强度降低系数ξ取值" + spinEdit43.Text;
        }
        //输入参数：界面粘结强度降低系数ξ
        private void SpinEdit43_EditValueChanged(object sender, EventArgs e)
        {
            popupContainerEdit4.Text = "根数:" + comboBoxEdit25.Text + ", 界面粘结强度降低系数ξ取值" + spinEdit43.Text;
        }

        private void Bolt_InputValueChange(object sender, EventArgs e)
        {
            CalculateBolt();
        }

        //锚杆设计选型计算
        private void CalculateBolt()
        {
            #region 控件为实体类入参赋值

            //定义传入参数对象
            BoltIn boltIn = new BoltIn();

            boltIn.BoltDiameter = double.Parse(spinEdit1.Text);
            boltIn.BoltMaterial = double.Parse(comboBoxEdit1.Text);
            boltIn.BoreholeDiameter = double.Parse(spinEdit2.Text);
            boltIn.WY_Value = double.Parse(spinEdit3.Text);
            boltIn.SafetyValue = double.Parse(spinEdit5.Text);
            boltIn.FmsValue = double.Parse(spinEdit9.Text);
            boltIn.MGD_Value = double.Parse(spinEdit29.Text);
            boltIn.GJ_Factor = double.Parse(labelControl236.Text);
            boltIn.GJ_Radical = comboBoxEdit25.Text;

            #endregion

            try
            {
                //通过http请求获取接口中传出参数
                string boltOutStr = HttpRequest.ResultData(boltIn, WellBuiltUrl + "BoltAction",out message);
                if (!string.IsNullOrEmpty(message))
                {
                    MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //将异常信息清空
                    message = null;
                    return;
                }
                //json转换为实体类
                BoltOut boltOut = JsonConvert.DeserializeObject<BoltOut>(boltOutStr);
                #region 实体类传出参数
                labelControl45.Text = boltOut.MGCS_SectionalArea.ToString();
                labelControl46.Text = boltOut.MGCS_Weight.ToString();
                labelControl48.Text = boltOut.MGCS_Strength.ToString();

                labelControl41.Text = boltOut.MGLL_DesignValue.ToString();
                labelControl42.Text = boltOut.MGLL_StandardValue.ToString();

                if (boltOut.MGCD_DC > boltOut.MGCD_JT)
                {
                    labelControl36.Text = boltOut.MGCD_DC.ToString() + "  √";
                    labelControl37.Text = boltOut.MGCD_JT.ToString();
                }
                else
                {
                    labelControl36.Text = boltOut.MGCD_DC.ToString();
                    labelControl37.Text = boltOut.MGCD_JT.ToString() + "  √";
                }

                labelControl38.Text = boltOut.MG_MinLength.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            #endregion

        }

        #endregion

        #region 构件重量计算
        //钢筋重量计算        
        private void Component_InputValueChange(object sender, EventArgs e)
        {
            CalTheWeightComponent();
        }

        private void CalTheWeightComponent()
        {
            ComponentIn componentIn = new ComponentIn();
            componentIn.GJ_Diameter = double.Parse(spinEdit8.Text);
            componentIn.GG_Diameter = double.Parse(spinEdit15.Text);
            componentIn.GG_Thickness = double.Parse(spinEdit16.Text);
            componentIn.GB_Thickness = double.Parse(spinEdit14.Text);

            componentIn.JSW_Diameter = double.Parse(comboBoxEdit6.Text);
            componentIn.JSW_Spacing = double.Parse(comboBoxEdit7.Text);
            componentIn.TB_Thickness = double.Parse(comboBoxEdit31.Text);
            componentIn.TB_Side = double.Parse(comboBoxEdit30.Text);
            componentIn.MG_Diameter = double.Parse(comboBoxEdit33.Text);
            componentIn.MG_Length = double.Parse(comboBoxEdit32.Text);

            componentIn.DG_Diameter = double.Parse(spinEdit12.Text);
            componentIn.DG_Length = double.Parse(spinEdit13.Text);
            componentIn.GZ_Diameter = double.Parse(spinEdit19.Text);
            componentIn.GZ_Height = double.Parse(spinEdit20.Text);
            componentIn.GZ_R = double.Parse(spinEdit21.Text);
            componentIn.JG_Standard = comboBoxEdit15.Text;
            componentIn.JG_Length = double.Parse(comboBoxEdit14.Text);
            try
            {
                //通过http请求获取接口中传出参数
                string componentOutStr = HttpRequest.ResultData(componentIn, WellBuiltUrl + "ComponentAction",out message);
                if (!string.IsNullOrEmpty(message))
                {
                    MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //将异常信息清空
                    message = null;
                    return;
                }
                //json转换为实体类
                ComponentOut componentOut = JsonConvert.DeserializeObject<ComponentOut>(componentOutStr);

                labelControl51.Text = componentOut.GJ_Area.ToString();
                labelControl52.Text = componentOut.GJ_Weight.ToString();
                labelControl74.Text = componentOut.GG_Weight.ToString();
                labelControl72.Text = componentOut.GB_Weight.ToString();
                labelControl54.Text = componentOut.JSW_Radical.ToString();
                labelControl56.Text = componentOut.JSW_Weight.ToString();
                labelControl59.Text = componentOut.TB_Weight.ToString();
                labelControl82.Text = componentOut.MG_Weight.ToString();
                labelControl66.Text = componentOut.YTMG_Weight.ToString();
                labelControl69.Text = componentOut.DG_WGR.ToString();
                labelControl65.Text = componentOut.DG_TotalLength.ToString();
                labelControl80.Text = componentOut.DG_Weight.ToString();
                labelControl91.Text = componentOut.GZ_WGR.ToString();
                labelControl89.Text = componentOut.GZ_TotalLength.ToString();
                labelControl87.Text = componentOut.GZ_Weight.ToString();
                labelControl105.Text = componentOut.JG_PieceWeight.ToString();
                labelControl101.Text = componentOut.JG_Weight.ToString();
                labelControl99.Text = componentOut.JG_Rib.ToString();
                labelControl97.Text = componentOut.JG_RibWeight.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

        }

        //每块托架重量
        private void advBandedGridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            int rows = e.RowHandle;
            //帖井壁立板尺寸重量
            if (e.Column.FieldName == "zjblbhd" || e.Column.FieldName == "zjblbkd" || e.Column.FieldName == "zjblbgd")
            {
                if (e.Column.FieldName == "zjblbkd")
                {
                    //支撑平板尺寸宽度随帖井壁立板尺寸宽度改变
                    this.advBandedGridView1.GetDataRow(rows)["pbkd1"] = e.Value;
                }
                //宽度和高度不为空时，计算重量
                if (!string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["zjblbhd"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["zjblbkd"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["zjblbgd"].ToString()))
                {
                    //ROUND(D14*E14*7.85*C14/10^6,2)
                    double hd = double.Parse(this.advBandedGridView1.GetDataRow(rows)["zjblbhd"].ToString());
                    double kd = double.Parse(this.advBandedGridView1.GetDataRow(rows)["zjblbkd"].ToString());
                    double gd = double.Parse(this.advBandedGridView1.GetDataRow(rows)["zjblbgd"].ToString());
                    this.advBandedGridView1.GetDataRow(rows)["zjblbzl"] = Math.Round(kd * gd * 7.85 * hd / 1000000, 2);
                }
                //每块托架重量
                if (!string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["zjblbzl"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["pbzl"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["lbzl"].ToString()))
                {
                    double zjblbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["zjblbzl"].ToString());
                    double pbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["pbzl"].ToString());
                    double lbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["lbzl"].ToString());
                    this.advBandedGridView1.GetDataRow(rows)["tjzl"] = zjblbzl + pbzl + lbzl;
                }
            }
            //支撑平板尺寸重量
            if (e.Column.FieldName == "pbhd" || e.Column.FieldName == "pbkd1" || e.Column.FieldName == "pbkd2" || e.Column.FieldName == "pbcd")
            {
                //肋板尺寸长度随支撑平板尺寸长度改变
                if (e.Column.FieldName == "pbcd")
                {
                    this.advBandedGridView1.GetDataRow(rows)["lbcd"] = e.Value;
                }
                //计算重量
                if (!string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["pbhd"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["pbkd1"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["pbkd2"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["pbcd"].ToString()))
                {
                    //ROUND((H14+I14)/2*J14*7.85*G14/10^6,2)
                    double hd = double.Parse(this.advBandedGridView1.GetDataRow(rows)["pbhd"].ToString());
                    double kd1 = double.Parse(this.advBandedGridView1.GetDataRow(rows)["pbkd1"].ToString());
                    double kd2 = double.Parse(this.advBandedGridView1.GetDataRow(rows)["pbkd2"].ToString());
                    double cd = double.Parse(this.advBandedGridView1.GetDataRow(rows)["pbcd"].ToString());
                    this.advBandedGridView1.GetDataRow(rows)["pbzl"] = Math.Round((kd1 + kd2) / 2 * cd * 7.85 * hd / 1000000, 2);
                }
                //每块托架重量
                if (!string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["zjblbzl"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["pbzl"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["lbzl"].ToString()))
                {
                    double zjblbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["zjblbzl"].ToString());
                    double pbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["pbzl"].ToString());
                    double lbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["lbzl"].ToString());
                    this.advBandedGridView1.GetDataRow(rows)["tjzl"] = zjblbzl + pbzl + lbzl;
                }
            }
            //肋板尺寸重量
            if (e.Column.FieldName == "lbhd" || e.Column.FieldName == "lbkd1" || e.Column.FieldName == "lbkd2" || e.Column.FieldName == "lbcd")
            {
                //计算重量
                if (!string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["lbhd"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["lbkd1"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["lbkd2"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["lbcd"].ToString()))
                {
                    //ROUND((H14+I14)/2*J14*7.85*G14/10^6,2)
                    double hd = double.Parse(this.advBandedGridView1.GetDataRow(rows)["lbhd"].ToString());
                    double kd1 = double.Parse(this.advBandedGridView1.GetDataRow(rows)["lbkd1"].ToString());
                    double kd2 = double.Parse(this.advBandedGridView1.GetDataRow(rows)["lbkd2"].ToString());
                    double cd = double.Parse(this.advBandedGridView1.GetDataRow(rows)["lbcd"].ToString());
                    this.advBandedGridView1.GetDataRow(rows)["lbzl"] = Math.Round((kd1 + kd2) / 2 * cd * 7.85 * hd / 1000000, 2);
                }
                //每块托架重量
                if (!string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["zjblbzl"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["pbzl"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["lbzl"].ToString()))
                {
                    double zjblbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["zjblbzl"].ToString());
                    double pbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["pbzl"].ToString());
                    double lbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["lbzl"].ToString());
                    this.advBandedGridView1.GetDataRow(rows)["tjzl"] = zjblbzl + pbzl + lbzl;
                }
            }
            //每块托架重量
            if (e.Column.FieldName == "zjblbzl" || e.Column.FieldName == "pbzl" || e.Column.FieldName == "lbzl")
            {
                //计算重量
                if (!string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["zjblbzl"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["pbzl"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView1.GetDataRow(rows)["lbzl"].ToString()))
                {
                    double zjblbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["zjblbzl"].ToString());
                    double pbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["pbzl"].ToString());
                    double lbzl = double.Parse(this.advBandedGridView1.GetDataRow(rows)["lbzl"].ToString());
                    this.advBandedGridView1.GetDataRow(rows)["tjzl"] = zjblbzl + pbzl + lbzl;
                }
            }
        }

        #endregion

        #region 水泥浆设计
        private void CementPaste_EditValueChanged(object sender, EventArgs e)
        {
            CementPasteIn cementPasteIn = new CementPasteIn();

            cementPasteIn.WaterDensity = double.Parse(spinEdit22.Text);
            cementPasteIn.Cement = double.Parse(spinEdit23.Text);
            cementPasteIn.Water = double.Parse(spinEdit25.Text);
            cementPasteIn.CementDensity = double.Parse(spinEdit24.Text);



            cementPasteIn.ZJ_λ = double.Parse(spinEdit26.Text);
            cementPasteIn.ZJ_R = double.Parse(spinEdit7.Text);
            cementPasteIn.ZJ_H = double.Parse(spinEdit4.Text);
            cementPasteIn.ZJ_η = double.Parse(spinEdit28.Text);
            cementPasteIn.ZJ_β = double.Parse(spinEdit27.Text);
            cementPasteIn.ZJ_M = double.Parse(spinEdit6.Text);

            try
            {
                //通过http请求获取接口中传出参数
                string cementPasteOutStr = HttpRequest.ResultData(cementPasteIn, WellBuiltUrl + "CementPasteAction",out message);
                if (!string.IsNullOrEmpty(message))
                {
                    MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //将异常信息清空
                    message = null;
                    return;
                }
                //json转换为实体类
                CementPasteOut cementPasteOut = JsonConvert.DeserializeObject<CementPasteOut>(cementPasteOutStr);
                popupContainerEdit11.Text = cementPasteOut.WaterCementRatioLaw.ToString();
                labelControl110.Text = cementPasteOut.YL_Water.ToString();
                labelControl111.Text = cementPasteOut.YL_Cement.ToString();
                labelControl10.Text = cementPasteOut.YL_SpecificGravity.ToString();
                labelControl21.Text = cementPasteOut.ZJL.ToString();
                labelControl12.Text = cementPasteOut.SNYL.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        #endregion

        #region 栏杆及门

        private void advBandedGridView4_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            int rows = e.RowHandle;
            if (e.Column.FieldName == "lggd" || e.Column.FieldName == "lgcd" || e.Column.FieldName == "ggcd")
            {
                this.advBandedGridView4.GetDataRow(rows)["ggzl1"] = 3.48;
                this.advBandedGridView4.GetDataRow(rows)["ggzl2"] = 2;
                if (!string.IsNullOrEmpty(this.advBandedGridView4.GetDataRow(rows)["lgcd"].ToString()))
                {
                    double lgcd = double.Parse(this.advBandedGridView4.GetDataRow(rows)["lgcd"].ToString());
                    this.advBandedGridView4.GetDataRow(rows)["fscd"] = lgcd;
                    this.advBandedGridView4.GetDataRow(rows)["lzgs"] = Math.Round(lgcd / 1000 + 1, 0);
                    if (!string.IsNullOrEmpty(this.advBandedGridView4.GetDataRow(rows)["lggd"].ToString()))
                    {
                        double lggd = double.Parse(this.advBandedGridView4.GetDataRow(rows)["lggd"].ToString());
                        double lzgs = double.Parse(this.advBandedGridView4.GetDataRow(rows)["lzgs"].ToString());
                        this.advBandedGridView4.GetDataRow(rows)["hjzl1"] = Math.Round((lgcd + lzgs * (lggd - 25)) / 1000 * 3.48, 2);
                        this.advBandedGridView4.GetDataRow(rows)["ggsl"] = lggd <= 1200 ? (lzgs - 1) * 2 : (lzgs - 1) * 3;
                        if (!string.IsNullOrEmpty(this.advBandedGridView4.GetDataRow(rows)["ggcd"].ToString()))
                        {
                            double ggcd = double.Parse(this.advBandedGridView4.GetDataRow(rows)["ggcd"].ToString());
                            double ggsl = double.Parse(this.advBandedGridView4.GetDataRow(rows)["ggsl"].ToString());
                            this.advBandedGridView4.GetDataRow(rows)["hjzl2"] = Math.Round(ggsl * ggcd / 1000 * 2, 2);
                            double hjzl1 = double.Parse(this.advBandedGridView4.GetDataRow(rows)["hjzl1"].ToString());
                            double hjzl2 = double.Parse(this.advBandedGridView4.GetDataRow(rows)["hjzl2"].ToString());
                            this.advBandedGridView4.GetDataRow(rows)["lgzz"] = hjzl1 + hjzl2;
                        }
                    }
                }
            }
        }

        private void advBandedGridView5_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {

            int rows = e.RowHandle;
            if (e.Column.FieldName == "gdhl" || e.Column.FieldName == "kdhl" || e.Column.FieldName == "mszl")
            {
                if (!string.IsNullOrEmpty(this.advBandedGridView5.GetDataRow(rows)["gdhl"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView5.GetDataRow(rows)["kdhl"].ToString()))
                {
                    double gdhl = double.Parse(this.advBandedGridView5.GetDataRow(rows)["gdhl"].ToString());
                    double kdhl = double.Parse(this.advBandedGridView5.GetDataRow(rows)["kdhl"].ToString());
                    this.advBandedGridView5.GetDataRow(rows)["cdbk"] = (gdhl + kdhl - 20) * 2;
                    double cdbk = double.Parse(this.advBandedGridView5.GetDataRow(rows)["cdbk"].ToString());
                    this.advBandedGridView5.GetDataRow(rows)["zlbk"] = Math.Round(cdbk / 1000 * 3.48, 2);
                    this.advBandedGridView5.GetDataRow(rows)["cdhg"] = gdhl <= 1200 ? (kdhl - 30) * 2 : (kdhl - 30) * 3;
                    double cdhg = double.Parse(this.advBandedGridView5.GetDataRow(rows)["cdhg"].ToString());
                    this.advBandedGridView5.GetDataRow(rows)["zlhg"] = cdhg / 1000 * 2;
                    if (!string.IsNullOrEmpty(this.advBandedGridView5.GetDataRow(rows)["mszl"].ToString()))
                    {
                        double zlbk = double.Parse(this.advBandedGridView5.GetDataRow(rows)["zlbk"].ToString());
                        double zlhg = double.Parse(this.advBandedGridView5.GetDataRow(rows)["zlhg"].ToString());
                        double mszl = double.Parse(this.advBandedGridView5.GetDataRow(rows)["mszl"].ToString());
                        this.advBandedGridView5.GetDataRow(rows)["dkm"] = zlbk + zlhg + mszl;
                        this.advBandedGridView5.GetDataRow(rows)["skm"] = (zlbk + zlhg + mszl) * 2;
                    }
                }
            }
        }
        #endregion

        #region 平台板计算
        private void initTable()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("b/a", Type.GetType("System.Double"));
            dt.Columns.Add("α1", Type.GetType("System.Double"));
            dt.Columns.Add("α2", Type.GetType("System.Double"));
            dt.Columns.Add("α3", Type.GetType("System.Double"));
            dt.Columns.Add("β", Type.GetType("System.Double"));
            dt.Rows.Add(1, 0.0479, 0.0479, 0.065, 0.0433);
            dt.Rows.Add(1.1, 0.0553, 0.0494, 0.07, 0.053);
            dt.Rows.Add(1.2, 0.0626, 0.0501, 0.074, 0.0616);
            dt.Rows.Add(1.3, 0.0693, 0.0504, 0.079, 0.0679);
            dt.Rows.Add(1.4, 0.0753, 0.0506, 0.083, 0.077);
            dt.Rows.Add(1.5, 0.0812, 0.0499, 0.085, 0.0843);
            dt.Rows.Add(1.6, 0.0862, 0.0493, 0.086, 0.0906);
            dt.Rows.Add(1.7, 0.0908, 0.0486, 0.088, 0.0964);
            dt.Rows.Add(1.8, 0.0948, 0.0479, 0.09, 0.1017);
            dt.Rows.Add(1.9, 0.0985, 0.0471, 0.091, 0.1064);
            dt.Rows.Add(2, 0.1017, 0.0464, 0.092, 0.1106);
            dt.Rows.Add(2.1, 0.125, 0.0375, 0.095, 0.1422);

            gridControl1.DataSource = dt;

        }
        /// <summary>
        /// 平台板界面中数值改变重新计算结果
        /// </summary>
        private void CalPlatValueChanged()
        {
            double a = double.Parse(spinEdit48.Text);
            double b = double.Parse(spinEdit47.Text);
            double ba = b / a;
            labelControl244.Text = ba.ToString("#0.000");
            double α1 = 0;
            double α2 = 0;
            double α3 = 0;
            double β = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (ba > 2)
                {
                    α1 = 0.125;
                    α2 = 0.0375;
                    α3 = 0.095;
                    β = 0.1422;
                    break;
                }
                double cc = double.Parse(gridView1.GetDataRow(i)["col1"].ToString());
                if (cc == ba)
                {
                    α1 = double.Parse(gridView1.GetDataRow(i)["col2"].ToString());
                    α2 = double.Parse(gridView1.GetDataRow(i)["col3"].ToString());
                    α3 = double.Parse(gridView1.GetDataRow(i)["col4"].ToString());
                    β = double.Parse(gridView1.GetDataRow(i)["col5"].ToString());
                    break;
                }
                if (cc > ba)
                {
                    double H10 = double.Parse(gridView1.GetDataRow(i)["col2"].ToString());
                    double H9 = double.Parse(gridView1.GetDataRow(i - 1)["col2"].ToString());
                    double G10 = double.Parse(gridView1.GetDataRow(i)["col1"].ToString());
                    double G9 = double.Parse(gridView1.GetDataRow(i - 1)["col1"].ToString());
                    α1 = (H10 - H9) * (ba - G9) / (G10 - G9) + H9;
                    double I10 = double.Parse(gridView1.GetDataRow(i)["col3"].ToString());
                    double I9 = double.Parse(gridView1.GetDataRow(i - 1)["col3"].ToString());
                    α2 = (I10 - I9) * (ba - G9) / (G10 - G9) + I9;
                    double J10 = double.Parse(gridView1.GetDataRow(i)["col4"].ToString());
                    double J9 = double.Parse(gridView1.GetDataRow(i - 1)["col4"].ToString());
                    α3 = (J10 - J9) * (ba - G9) / (G10 - G9) + J9;
                    double K10 = double.Parse(gridView1.GetDataRow(i)["col5"].ToString());
                    double K9 = double.Parse(gridView1.GetDataRow(i - 1)["col5"].ToString());
                    β = (K10 - K9) * (ba - G9) / (G10 - G9) + K9;
                    break;
                }
            }
            labelControl256.Text = α1.ToString("#0.0000");
            labelControl260.Text = α2.ToString("#0.0000");
            labelControl263.Text = α3.ToString("#0.0000");
            labelControl272.Text = β.ToString("#0.0000");

            PlatFormIn platFormIn = new PlatFormIn();

            platFormIn.SteelMarks = comboBoxEdit27.Text;
            platFormIn.PTB_Width = double.Parse(spinEdit48.Text);
            platFormIn.WJ_α1 = double.Parse(labelControl256.Text);
            platFormIn.WJ_α2 = double.Parse(labelControl260.Text);
            platFormIn.WJ_α3 = double.Parse(labelControl263.Text);
            platFormIn.MD_β = double.Parse(labelControl272.Text);
            //平台荷载
            platFormIn.PlatformLoad = double.Parse(spinEdit44.Text);
            //平台板厚度
            platFormIn.PTB_Thicknessorm = double.Parse(spinEdit45.Text);

            try
            {
                //通过http请求获取接口中传出参数
                string platFormOutStr = HttpRequest.ResultData(platFormIn, WellBuiltUrl + "PlatFormAction",out message);
                if (!string.IsNullOrEmpty(message))
                {
                    MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //将异常信息清空
                    message = null;
                    return;
                }
                //json转换为实体类
                PlatFormOut platFormOut = JsonConvert.DeserializeObject<PlatFormOut>(platFormOutStr);
                double qd = platFormOut.SteelStrength;
                double Mx = platFormOut.WJ_Mx;
                double My = platFormOut.WJ_My;
                double Mxy = platFormOut.WJ_Mxy;
                double Mmax = platFormOut.WJ_Mmax;
                double σmax = platFormOut.QD_σmax;
                double νmax = platFormOut.MD_νmax;
                //钢材强度
                labelControl247.Text = qd.ToString();
                labelControl269.Text = Mx.ToString();
                labelControl268.Text = My.ToString();
                labelControl267.Text = Mxy.ToString();
                labelControl265.Text = Mmax.ToString();
                labelControl252.Text = νmax.ToString("#0.00000");
                labelControl248.Text = σmax.ToString("#0.00000");
                labelControl250.Text = σmax < qd ? "强度OK" : "强度No";
                labelControl250.ToolTip = "计算值：" + σmax.ToString("#0.00000") + "，容许值：" + qd;
                labelControl250.ForeColor = σmax < qd ? Color.DarkGreen : Color.Red;
                labelControl251.Text = νmax < a / 150 ? "挠度OK" : "挠度NO";
                labelControl251.ToolTip = "计算值：" + νmax.ToString("#0.00000") + "，容许值：" + (a / 150);
                labelControl251.ForeColor = νmax < a / 150 ? Color.DarkGreen : Color.Red;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }

        private void PTB_EditValueChanged(object sender, EventArgs e)
        {
            CalPlatValueChanged();
        }
        //平台板长度数值限制
        private void spinEdit47_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
        {
            if ((decimal)e.NewValue < spinEdit48.Value)
            {
                e.Cancel = true;
                return;
            }
        }
        //平台板宽度数值限制
        private void spinEdit48_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
        {
            if ((decimal)e.NewValue > spinEdit47.Value)
            {
                e.Cancel = true;
                return;
            }
        }



        #endregion

        #region 风井装备
        private void FJZB_EditValueChanged(object sender, EventArgs e)
        {
            FJZB_displayResults();
        }
        public void FJZB_displayResults()
        {
            VentShaftIn ventShaftIn = new VentShaftIn();
            //平台类型
            string ptType = ventShaftIn.PT_Type = comboBoxEdit9.SelectedItem.ToString();
            //梯子类型
            string tzType = ventShaftIn.TZ_Type = comboBoxEdit10.SelectedItem.ToString();
            //栏栅类型
            string lsType = ventShaftIn.LZ_Type = comboBoxEdit11.SelectedItem.ToString();

            ventShaftIn.SliceGap = double.Parse(comboBoxEdit8.SelectedItem.ToString());
            ventShaftIn.Depth = double.Parse(spinEdit31.Value.ToString());
            ventShaftIn.Number = double.Parse(spinEdit33.Value.ToString());
            ventShaftIn.PT_Standard = comboBoxEdit26.Text;
            ventShaftIn.PT_Area = (double)spinEdit41.Value;

            for (int i = 0; i < gridView2.RowCount; i++)
            {
                ventShaftIn.Total += double.Parse(gridView2.GetDataRow(i)["total"].ToString());
            }

            #region 不同平台类型对应重量
            switch (ptType)
            {
                case "钢板平台":
                    xtraTabPage10.PageVisible = true;
                    xtraTabPage11.PageVisible = false;
                    break;
                case "玻璃钢平台":
                    xtraTabPage11.PageVisible = true;
                    xtraTabPage10.PageVisible = false;
                    listBoxControl1.Items.Clear();
                    string[] strs1 = { "70", "77", "84" };
                    listBoxControl1.Items.AddRange(strs1);
                    break;
                default:
                    xtraTabPage11.PageVisible = true;
                    xtraTabPage10.PageVisible = false;
                    listBoxControl1.Items.Clear();
                    string[] strs = { "--", "--", "--" };
                    listBoxControl1.Items.AddRange(strs);
                    break;
            }
            switch (tzType)
            {
                case "钢梯子":
                    listBoxControl2.Items.Clear();
                    string[] strs1 = { "58", "77", "84" };
                    listBoxControl2.Items.AddRange(strs1);
                    break;
                case "玻璃钢梯子":
                    listBoxControl2.Items.Clear();
                    string[] strs2 = { "93", "101", "111" };
                    listBoxControl2.Items.AddRange(strs2);
                    break;
                default:
                    listBoxControl2.Items.Clear();
                    listBoxControl2.Items.Clear();
                    string[] strs3 = { "--", "--", "--" };
                    listBoxControl2.Items.AddRange(strs3);
                    break;
            }
            switch (lsType)
            {
                case "钢栏栅":
                    listBoxControl3.Items.Clear();
                    string[] strs1 = { "175", "186", "211" };
                    listBoxControl3.Items.AddRange(strs1);
                    break;
                case "玻璃钢栏栅":
                    listBoxControl3.Items.Clear();
                    string[] strs2 = { "235", "251", "295" };
                    listBoxControl3.Items.AddRange(strs2);
                    break;
                default:
                    listBoxControl3.Items.Clear();
                    string[] strs3 = { "--", "--", "--" };
                    listBoxControl3.Items.AddRange(strs3);
                    break;
            }
            #endregion      

            try
            {
                //通过http请求获取接口中传出参数
                string ventShaftOutStr = HttpRequest.ResultData(ventShaftIn, WellBuiltUrl + "VentShaftAction",out message);
                if (!string.IsNullOrEmpty(message))
                {
                    MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //将异常信息清空
                    message = null;
                    return;
                }
                //json转换为实体类
                VentShaftOut ventShaftOut = JsonConvert.DeserializeObject<VentShaftOut>(ventShaftOutStr);


                //每层材料-玻璃钢
                //=玻璃钢平台+玻璃钢梯子+玻璃钢栏栅
                labelControl146.Text = ventShaftOut.MC_Fiberglass.ToString();
                labelControl145.Text = ventShaftOut.MC_Steel.ToString();
                //总材料-玻璃钢
                labelControl151.Text = ventShaftOut.ZL_Fiberglass.ToString();
                //总材料-钢材=ROUND(G24*(ROUND((F2/D3+0.2),0)+2*F3)/1000,2)+N14
                labelControl149.Text = ventShaftOut.ZL_Steel.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

        }
        //每行筛选不同的下拉列表
        private void repositoryItemGridLookUpEdit1_Popup(object sender, EventArgs e)
        {
            GridLookUpEdit edit = sender as GridLookUpEdit;
            if (edit.EditValue.ToString() == "I20" || edit.EditValue.ToString() == "I22" || edit.EditValue.ToString() == "I25" || edit.EditValue.ToString() == "I28" || edit.EditValue.ToString() == "I30" || edit.EditValue.ToString() == "I32" || edit.EditValue.ToString() == "I36" || edit.EditValue.ToString() == "I40")
            {
                edit.Properties.View.ActiveFilterString = "Gg=='I20'||Gg=='I22'||Gg=='I25'||Gg=='I28'||Gg=='I30'||Gg=='I32'||Gg=='I36'||Gg=='I40'";
                return;
            }
            else if (edit.EditValue.ToString() == "[20" || edit.EditValue.ToString() == "[22" || edit.EditValue.ToString() == "[24" || edit.EditValue.ToString() == "[25" || edit.EditValue.ToString() == "[28" || edit.EditValue.ToString() == "[30" || edit.EditValue.ToString() == "[32" || edit.EditValue.ToString() == "[36")
            {
                edit.Properties.View.ActiveFilterString = "Gg=='[20'||Gg=='[22'||Gg=='[24'||Gg=='[25'||Gg=='[28'||Gg=='[30'||Gg=='[32'||Gg=='[36'";
                return;
            }
            else if(edit.EditValue.ToString() == "[14b" || edit.EditValue.ToString() == "[12.6" || edit.EditValue.ToString() == "[12")
            {
                edit.Properties.View.ActiveFilterString = "Gg=='[14b'||Gg=='[12.6'||Gg=='[12'";
                return;
            }
            else if (edit.EditValue.ToString() == "L140x16" || edit.EditValue.ToString() == "L140x14" || edit.EditValue.ToString() == "L160x16" || edit.EditValue.ToString() == "L160x14")
            {
                edit.Properties.View.ActiveFilterString = "Gg=='L140x16'||Gg=='L140x14'||Gg=='L160x16'||Gg=='L160x14'";
                return;
            }
            else if (edit.EditValue.ToString() == "L125x16" || edit.EditValue.ToString() == "L125x14" || edit.EditValue.ToString() == "L110x14" || edit.EditValue.ToString() == "L100x14")
            {
                edit.Properties.View.ActiveFilterString = "Gg=='L125x16'||Gg=='L125x14'||Gg=='L110x14'||Gg=='L100x14'";
                return;
            }
            else if (edit.EditValue.ToString() == "30" || edit.EditValue.ToString() == "28" || edit.EditValue.ToString() == "25" || edit.EditValue.ToString() == "22")
            {
                edit.Properties.View.ActiveFilterString = "Gg=='30'||Gg=='28'||Gg=='25'||Gg=='22'";
                return;
            }
        }

        private void gridView2_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            int row = e.RowHandle;
            if (e.Column.Caption == "规格" || e.Column.Caption == "数量" || e.Column.Caption == "长度/面积(m/m2)")
            {
                #region 通过规格计算单重
                switch (e.Value)
                {
                    case "I20":
                        gridView2.GetDataRow(row)["dz"] = 31.07;
                        break;
                    case "I22":
                        gridView2.GetDataRow(row)["dz"] = 36.53;
                        break;
                    case "I25":
                        gridView2.GetDataRow(row)["dz"] = 42.03;
                        break;
                    case "I28":
                        gridView2.GetDataRow(row)["dz"] = 47.89;
                        break;
                    case "I30":
                        gridView2.GetDataRow(row)["dz"] = 52.8;
                        break;
                    case "I32":
                        gridView2.GetDataRow(row)["dz"] = 57.74;
                        break;
                    case "I36":
                        gridView2.GetDataRow(row)["dz"] = 65.69;
                        break;
                    case "I40":
                        gridView2.GetDataRow(row)["dz"] = 73.88;
                        break;
                    case "[36":
                        gridView2.GetDataRow(row)["dz"] = 53.466;
                        break;
                    case "[20":
                        gridView2.GetDataRow(row)["dz"] = 25.78;
                        break;
                    case "[22":
                        gridView2.GetDataRow(row)["dz"] = 28.46;
                        break;
                    case "[24":
                        gridView2.GetDataRow(row)["dz"] = 30.63;
                        break;
                    case "[25":
                        gridView2.GetDataRow(row)["dz"] = 31.34;
                        break;
                    case "[28":
                        gridView2.GetDataRow(row)["dz"] = 35.83;
                        break;
                    case "[30":
                        gridView2.GetDataRow(row)["dz"] = 39.18;
                        break;
                    case "[32":
                        gridView2.GetDataRow(row)["dz"] = 43.11;
                        break;
                    case "[14b":
                        gridView2.GetDataRow(row)["dz"] = 16.74;
                        break;
                    case "[12.6":
                        gridView2.GetDataRow(row)["dz"] = 12.32;
                        break;
                    case "[12":
                        gridView2.GetDataRow(row)["dz"] = 12.1;
                        break;
                    case "L140x16":
                        gridView2.GetDataRow(row)["dz"] = 33.4;
                        break;
                    case "L140x14":
                        gridView2.GetDataRow(row)["dz"] = 29.5;
                        break;
                    case "L160x16":
                        gridView2.GetDataRow(row)["dz"] = 38.52;
                        break;
                    case "L160x14":
                        gridView2.GetDataRow(row)["dz"] = 34;
                        break;
                    case "L125x14":
                        gridView2.GetDataRow(row)["dz"] = 26.2;
                        break;
                    case "L125x16":
                        gridView2.GetDataRow(row)["dz"] = 29.63;
                        break;
                    case "L110x14":
                        gridView2.GetDataRow(row)["dz"] = 22.81;
                        break;
                    case "L100x14":
                        gridView2.GetDataRow(row)["dz"] = 20.61;
                        break;
                }
                //大锚杆单重
                if (row == 8 || row == 9)
                {
                    double gg = double.Parse(gridView2.GetDataRow(row)["gg"].ToString());
                    gridView2.GetDataRow(row)["dz"] = Math.Round(Math.Pow(gg, 2) * Math.PI / 4 * 7.85 / 1000, 2);
                }
                #endregion
                double cd_mj = double.Parse(gridView2.GetDataRow(row)["cd/mj"].ToString());
                double dz = double.Parse(gridView2.GetDataRow(row)["dz"].ToString());
                double amount = double.Parse(gridView2.GetDataRow(row)["amount"].ToString());
                if (gridView2.GetDataRow(row)["name"].ToString() == "大托板")
                    gridView2.GetDataRow(row)["total"] = cd_mj == 0 ? 0 : Math.Round((cd_mj * dz + 1) * amount, 2);
                else
                    gridView2.GetDataRow(row)["total"] = Math.Round(cd_mj * dz * amount, 2);
                FJZB_displayResults();
            }
        }
        #endregion

        #region 工字钢梁计算

        private void Girder_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxEdit23.SelectedItem.ToString() == "1个集中荷载")
            {
                xtraTabPage7.PageVisible = true;
                xtraTabPage8.PageVisible = false;
            }
            else
            {
                xtraTabPage7.PageVisible = false;
                xtraTabPage8.PageVisible = true;
            }
            GirderValueChange();
        }
        public void GirderValueChange()
        {
            GirderIn girderIn = new GirderIn();
            girderIn.LoadType = comboBoxEdit23.SelectedItem.ToString();
            girderIn.SteelMarks = comboBoxEdit22.SelectedItem.ToString();
            girderIn.ISteel = double.Parse(comboBoxEdit21.Text);
            girderIn.Factor = double.Parse(spinEdit32.Value.ToString());
            girderIn.Deflection = comboBoxEdit24.SelectedItem.ToString();

            girderIn.P1 = double.Parse(spinEdit36.Value.ToString());
            girderIn.P1_1 = double.Parse(spinEdit57.Value.ToString());
            girderIn.A = double.Parse(spinEdit35.Value.ToString());
            girderIn.B = double.Parse(spinEdit34.Value.ToString());
            girderIn.L0_1 = double.Parse(spinEdit37.Value.ToString());
            girderIn.P2 = double.Parse(spinEdit46.Value.ToString());
            girderIn.P2_1 = double.Parse(spinEdit58.Value.ToString());
            girderIn.P3 = double.Parse(spinEdit42.Value.ToString());
            girderIn.P3_1 = double.Parse(spinEdit59.Value.ToString());
            girderIn.A1 = double.Parse(spinEdit53.Value.ToString());
            girderIn.B1 = double.Parse(spinEdit39.Value.ToString());
            girderIn.C1 = double.Parse(spinEdit38.Value.ToString());
            girderIn.L0_2 = double.Parse(spinEdit40.Value.ToString());

            try
            {
                //通过http请求获取接口中传出参数
                string girderOutStr = HttpRequest.ResultData(girderIn, WellBuiltUrl + "GirderAction",out message);
                if (!string.IsNullOrEmpty(message))
                {
                    MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //将异常信息清空
                    message = null;
                    return;
                }
                //json转换为实体类
                GirderOut girderOut = JsonConvert.DeserializeObject<GirderOut>(girderOutStr);

                //强度
                double F17 = girderOut.QD_Calculated;
                double F5 = girderOut.QD_Admissible;
                labelControl161.Text = girderOut.QD_Checking;
                labelControl161.ToolTip = "计算值：" + F17 + "，容许值：" + F5;
                labelControl161.ForeColor = F17 < F5 ? Color.DarkGreen : Color.Red;
                //整体稳定性=IF(F19<F5,"稳定性OK","重新选梁")
                double F19 = girderOut.WDX_Calculated;
                labelControl158.Text = girderOut.WDX_Checking;
                labelControl158.ToolTip = "计算值：" + F19 + "，容许值：" + F5;
                labelControl158.ForeColor = F19 < F5 ? Color.DarkGreen : Color.Red;
                //挠度=IF(D22<I22,"挠度OK","重新选梁")
                double D22 = girderOut.ND_Calculated;
                double I22 = girderOut.ND_Admissible;
                labelControl173.Text = D22 < I22 ? "挠度OK" : "重新选梁";
                labelControl173.ToolTip = "计算值：" + D22 + "，容许值：" + I22;
                labelControl173.ForeColor = D22 < I22 ? Color.DarkGreen : Color.Red;
                //抗剪强度=IF(F27<G5,"抗剪OK","重新选梁")
                double G5 = girderOut.KJ_Admissible;
                double F27 = girderOut.KJ_Calculated;
                labelControl188.Text = girderOut.KJ_Checking;
                labelControl188.ToolTip = "计算值：" + F27 + "，容许值：" + G5;
                labelControl188.ForeColor = F27 < G5 ? Color.DarkGreen : Color.Red;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        #endregion

        #region 焊接吊车梁计算
        private void CraneBeam_SelectedIndexChanged(object sender, EventArgs e)
        {
            CraneBeamIn craneBeamIn = new CraneBeamIn();
            //上翼缘正应力=IF(D21<G11,"OK","NO")
            craneBeamIn.DC_Tread = (double)spinEdit70.Value;
            craneBeamIn.DC_Span = (double)spinEdit61.Value ;
            craneBeamIn.MaxWheelLoad = (double)spinEdit67.Value ;
            craneBeamIn.BeamHeight = (double)spinEdit74.Value;
            craneBeamIn.SY_Width = (double)spinEdit75.Value;
            craneBeamIn.Aperture = (double)spinEdit77.Value;
            craneBeamIn.YY_Thickness = (double)spinEdit72.Value;
            craneBeamIn.XY_Width = (double)spinEdit71.Value;
            craneBeamIn.FB_Thickness = (double)spinEdit73.Value;
            craneBeamIn.ZJ_Weight = (double)spinEdit64.Value;
            craneBeamIn.XC_Weight = (double)spinEdit69.Value;
            craneBeamIn.CenterDistance= (double)spinEdit76.Value;
            craneBeamIn.JJL_Width = (double)spinEdit78.Value;
            craneBeamIn.JJL_Thickness = (double)spinEdit79.Value;
            craneBeamIn.JJL_φ= (double)spinEdit80.Value;
            craneBeamIn.HX_Spacing = (double)spinEdit82.Value;

            craneBeamIn.SteelMarks = comboBoxEdit28.Text;
            craneBeamIn.OrbitModel = comboBoxEdit29.Text;
            craneBeamIn.BridgeCrane = checkEdit1.Checked;
            try
            {
                //通过http请求获取接口中传出参数
                string craneBeamOutStr = HttpRequest.ResultData(craneBeamIn, WellBuiltUrl + "CraneBeamAction",out message);
                if (!string.IsNullOrEmpty(message))
                {
                    MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //将异常信息清空
                    message = null;
                    return;
                }
                //json转换为实体类
                CraneBeamOut craneBeamOut = JsonConvert.DeserializeObject<CraneBeamOut>(craneBeamOutStr);

                double D21 = craneBeamOut.QD_SYYCalculated;
                double G11 = craneBeamOut.QD_SYYAdmissible;
                labelControl282.Text = craneBeamOut.QD_SYY;
                labelControl282.ToolTip = "计算值：" + D21 + "，容许值：" + G11;
                labelControl282.ForeColor = D21 < G11 ? Color.DarkGreen : Color.Red;
                double D22 = craneBeamOut.QD_XYYCalculated;
                labelControl283.Text = craneBeamOut.QD_XYY;
                labelControl283.ToolTip = "计算值：" + D22 + "，容许值：" + G11;
                labelControl283.ForeColor = D22 < G11 ? Color.DarkGreen : Color.Red;
                double D23 = craneBeamOut.QD_PBCalculated;
                double G12 = craneBeamOut.QD_PBAdmissible;
                //平板支座剪应力=IF(D23<G12,"OK","NO")
                labelControl284.Text = craneBeamOut.QD_PB;
                labelControl284.ToolTip = "计算值：" + D23 + "，容许值：" + G12;
                labelControl284.ForeColor = D23 < G12 ? Color.DarkGreen : Color.Red;
                double D24 = craneBeamOut.QD_FBCalculated;
                //腹板局部压应力=IF(D24<G11,"OK","NO")
                labelControl285.Text = craneBeamOut.QD_FB;
                labelControl285.ToolTip = "计算值：" + D24 + "，容许值：" + G11;
                labelControl285.ForeColor = D24 < G11 ? Color.DarkGreen : Color.Red;
                double D39 = craneBeamOut.ZTWDX_Calculated;
                //整体稳定性=IF(D39<=G11,"整体稳定性OK","整体稳定性NO")
                labelControl286.Text = craneBeamOut.ZTWDX;
                labelControl286.ToolTip = "计算值：" + D39 + "，容许值：" + G11;
                labelControl286.ForeColor = D39 <= G11 ? Color.DarkGreen : Color.Red;
                double D44 = craneBeamOut.ND_Calculated;
                double G13 = craneBeamOut.ND_Admissible;
                //挠度判断=IF(D44<1/G13,"挠度OK","挠度NO")
                //G13=IF(J7="Y",1000,500)
                labelControl287.Text = craneBeamOut.ND;
                labelControl287.ToolTip = "计算值：" + D44 + "，容许值：" + G13;
                labelControl287.ForeColor = D44 < (1 / G13) ? Color.DarkGreen : Color.Red;
                double D47 = craneBeamOut.DMCY_Calculated;
                double L15 = craneBeamOut.DMCY_Admissible;
                //支座加劲肋端面承压=IF(D47<L15,"OK","NO")
                labelControl288.Text = craneBeamOut.DMCY;
                labelControl288.ToolTip = "计算值：" + D47 + "，容许值：" + L15;
                labelControl288.ForeColor = D47 < L15 ? Color.DarkGreen : Color.Red;
                double D52 = craneBeamOut.JJLWDX_Calculated;
                //支座加劲肋稳定性=IF(D52<G11,"OK","NO")
                labelControl289.Text = craneBeamOut.JJLWDX;
                labelControl289.ToolTip = "计算值：" + D52 + "，容许值：" + G11;
                labelControl289.ForeColor = D52 < G11 ? Color.DarkGreen : Color.Red;
                object D56 = craneBeamOut.SYYHF;
                //上翼缘与腹板的连接焊缝=IF(D55<8,8,D55+2)
                labelControl290.Text = D56.ToString() + "mm";
                object D59 = craneBeamOut.XYYHF;
                //下翼缘与腹板的连接焊缝=IF(D58<6,6,D58+2)
                labelControl291.Text = D59.ToString() + "mm";
                object D62 = craneBeamOut.JJLHF;
                //支座加劲肋与腹板的连接焊缝=IF(D61<8,8,D61+2)
                labelControl292.Text = D62.ToString() + "mm";

                //配置横向加劲肋=IF(J6="Q235",IF(I27<=80,"宜配横肋","须配横肋"),IF(J6="Q345",IF(I27<=66,"宜配横肋","须配横肋")))
                labelControl293.Text = craneBeamOut.PZHL;
                double J44 = craneBeamOut.FBWDX_Calculated;
                //labelControl293.ForeColor = J6 == "Q235" ? (I27 <= 80 ? Color.DarkGreen : Color.Red) : (I27 <= 66 ? Color.DarkGreen : Color.Red);
                //腹板局部稳定性=IF(J44<=1,"稳定性OK","稳定性NO")
                labelControl294.Text = craneBeamOut.FBWDX;
                labelControl294.ToolTip = "计算值：" + J44 + "，容许值：" + 1;
                labelControl294.ForeColor = J44 <= 1 ? Color.DarkGreen : Color.Red;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
}
        #endregion

        #region 圆形断面配筋及矿仓加固

        //圆形井筒及矿仓配筋估算
        private void advBandedGridView2_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            int rows = e.RowHandle;
            double length = double.Parse(lengthComboBoxEdit.SelectedItem.ToString());
            if (e.Column.FieldName == "jtzj" || e.Column.FieldName == "zhhd" || e.Column.FieldName == "zjc" || e.Column.FieldName == "zhhd" || e.Column.FieldName == "jj1" || e.Column.FieldName == "jj2" || e.Column.FieldName == "zjds" || e.Column.FieldName == "fjc" || e.Column.FieldName == "zhhd" || e.Column.FieldName == "zj" || e.Column.FieldName == "jj3" || e.Column.FieldName == "zjc1" || e.Column.FieldName == "cd")
            {
                double jtzj = 0;
                if (!string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["jtzj"].ToString()))
                {
                    jtzj = double.Parse(this.advBandedGridView2.GetDataRow(rows)["jtzj"].ToString());
                    this.advBandedGridView2.GetDataRow(rows)["sj"] = Math.Round(Math.Pow(jtzj, 2) * Math.PI / 4, 3);
                }
                if (!string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["jj1"].ToString()))
                {
                    double jj1 = double.Parse(this.advBandedGridView2.GetDataRow(rows)["jj1"].ToString());
                    this.advBandedGridView2.GetDataRow(rows)["zgssc"] = 2 * length / jj1;
                }
                if (!string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["zhhd"].ToString()))
                {
                    double zhhd = double.Parse(this.advBandedGridView2.GetDataRow(rows)["zhhd"].ToString());
                    this.advBandedGridView2.GetDataRow(rows)["sjj"] = Math.Round(Math.Pow((jtzj + 2 * zhhd / 1000), 2) * Math.PI / 4, 3);
                    this.advBandedGridView2.GetDataRow(rows)["sl"] = Math.Round((jtzj * 1000 + zhhd * 2) * Math.PI / 1000 + 0.5, 0);
                    if (!string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["jj2"].ToString()))
                    {
                        double jj2 = double.Parse(this.advBandedGridView2.GetDataRow(rows)["jj2"].ToString());
                        this.advBandedGridView2.GetDataRow(rows)["zgslq"] = Math.Round((jtzj * 1000 + zhhd) * Math.PI / jj2 + 0.3, 0) * 2;
                        if (!string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["zjc"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["zjds"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["fjc"].ToString()))
                        {
                            double zjc = double.Parse(this.advBandedGridView2.GetDataRow(rows)["zjc"].ToString());
                            double zjds = double.Parse(this.advBandedGridView2.GetDataRow(rows)["zjds"].ToString());
                            double fjc = double.Parse(this.advBandedGridView2.GetDataRow(rows)["fjc"].ToString());
                            double zgssc = double.Parse(this.advBandedGridView2.GetDataRow(rows)["zgssc"].ToString());
                            double zgslq = double.Parse(this.advBandedGridView2.GetDataRow(rows)["zgslq"].ToString());
                            //ROUND((((B5*1000+C5)*PI()+H5*43*F5)*I5*F5^2*PI()/4+(M1+43*J5)*L5*J5^2*PI()/4)*7.85/10^6*1.06,0)
                            this.advBandedGridView2.GetDataRow(rows)["gjzl"] = Math.Round((((jtzj * 1000 + zhhd) * Math.PI + zjds * 43 * zjc) * zgssc * Math.Pow(zjc, 2) * Math.PI / 4 + (length + 43 * fjc) * zgslq * Math.Pow(fjc, 2) * Math.PI / 4) * 7.85 / 1000000 * 1.06, 0);
                        }
                    }
                    if (!string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["zj"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["jj3"].ToString()))
                    {
                        double zj = double.Parse(this.advBandedGridView2.GetDataRow(rows)["zj"].ToString());
                        double jj3 = double.Parse(this.advBandedGridView2.GetDataRow(rows)["jj3"].ToString());
                        this.advBandedGridView2.GetDataRow(rows)["jswzl"] = Math.Round(Math.Round((jtzj * 1000 + 2 * zhhd) * Math.PI / 1000 + 0.4, 0) * Math.Round((1000 / jj3 + 1.4), 0) * 2 * Math.Pow(zj, 2) * Math.PI / 4 * 0.00785 * 1.15, 2);
                        if (!string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["zjc1"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["cd"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(rows)["sl"].ToString()))
                        {
                            double zjc1 = double.Parse(this.advBandedGridView2.GetDataRow(rows)["zjc1"].ToString());
                            double cd = double.Parse(this.advBandedGridView2.GetDataRow(rows)["cd"].ToString());
                            double sl = double.Parse(this.advBandedGridView2.GetDataRow(rows)["sl"].ToString());
                            this.advBandedGridView2.GetDataRow(rows)["slAll"] = Math.Round((Math.Pow(0.15, 2) * 78.5 * 1.2 + Math.Pow(zjc1, 2) * Math.PI / 4 * cd * 7.85 / 1000000) * sl, 2);
                        }
                    }
                }
            }
        }
        //计算长度数值变更触发事件
        private void lengthComboBoxEdit_SelectedIndexChanged(object sender, EventArgs e)
        {
            double length = double.Parse(lengthComboBoxEdit.SelectedItem.ToString());
            for (int i = 0; i < this.advBandedGridView2.RowCount; i++)
            {
                if (!string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(i)["jj1"].ToString()))
                {
                    double jj1 = double.Parse(this.advBandedGridView2.GetDataRow(i)["jj1"].ToString());
                    this.advBandedGridView2.GetDataRow(i)["zgssc"] = 2 * length / jj1;
                }
                if (!string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(i)["jtzj"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(i)["zhhd"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(i)["zjc"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(i)["zjds"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(i)["zgssc"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(i)["fjc"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView2.GetDataRow(i)["zgslq"].ToString()))
                {
                    double jtzj = double.Parse(this.advBandedGridView2.GetDataRow(i)["jtzj"].ToString());
                    double zhhd = double.Parse(this.advBandedGridView2.GetDataRow(i)["zhhd"].ToString());
                    double zjds = double.Parse(this.advBandedGridView2.GetDataRow(i)["zjds"].ToString());
                    double zjc = double.Parse(this.advBandedGridView2.GetDataRow(i)["zjc"].ToString());
                    double zgssc = double.Parse(this.advBandedGridView2.GetDataRow(i)["zgssc"].ToString());
                    double fjc = double.Parse(this.advBandedGridView2.GetDataRow(i)["fjc"].ToString());
                    double zgslq = double.Parse(this.advBandedGridView2.GetDataRow(i)["zgslq"].ToString());
                    this.advBandedGridView2.GetDataRow(i)["gjzl"] = Math.Round((((jtzj * 1000 + zhhd) * Math.PI + zjds * 43 * zjc) * zgssc * Math.Pow(zjc, 2) * Math.PI / 4 + (length + 43 * fjc) * zgslq * Math.Pow(fjc, 2) * Math.PI / 4) * 7.85 / 1000000 * 1.06, 0);
                }
            }
        }

        //圆形矿仓加固衬板估算
        private void advBandedGridView3_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            int rows = e.RowHandle;
            if (e.Column.FieldName == "kczj" || e.Column.FieldName == "hd" || e.Column.FieldName == "kd" || e.Column.FieldName == "cd1" || e.Column.FieldName == "mkks" || e.Column.FieldName == "mglx" || e.Column.FieldName == "mgzj" || e.Column.FieldName == "mgcd")
            {
                if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["kd"].ToString()))
                {
                    double kd = double.Parse(this.advBandedGridView3.GetDataRow(rows)["kd"].ToString());
                    if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["kczj"].ToString()))
                    {
                        double kczj = double.Parse(this.advBandedGridView3.GetDataRow(rows)["kczj"].ToString());
                        this.advBandedGridView3.GetDataRow(rows)["ks"] = Math.Round((kczj * Math.PI / kd * 1000 - 0.3), 0);
                    }
                    if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["hd"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["cd1"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["mkks"].ToString()))
                    {
                        double hd = double.Parse(this.advBandedGridView3.GetDataRow(rows)["hd"].ToString());
                        double cd1 = double.Parse(this.advBandedGridView3.GetDataRow(rows)["cd1"].ToString());
                        double mkks = double.Parse(this.advBandedGridView3.GetDataRow(rows)["mkks"].ToString());
                        this.advBandedGridView3.GetDataRow(rows)["dz"] = Math.Round(kd * hd * cd1 * 7.85 / 1000000 + mkks * 2, 2);
                    }
                    if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["dz"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["ks"].ToString()))
                    {
                        double dz = double.Parse(this.advBandedGridView3.GetDataRow(rows)["dz"].ToString());
                        double ks = double.Parse(this.advBandedGridView3.GetDataRow(rows)["ks"].ToString());
                        this.advBandedGridView3.GetDataRow(rows)["cbzl"] = dz * ks;
                        if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["hj"].ToString()))
                        {
                            double cbzl = double.Parse(this.advBandedGridView3.GetDataRow(rows)["cbzl"].ToString());
                            double hj = double.Parse(this.advBandedGridView3.GetDataRow(rows)["hj"].ToString());
                            this.advBandedGridView3.GetDataRow(rows)["zl"] = cbzl + hj;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["mglx"].ToString()))
                {
                    string mglx = this.advBandedGridView3.GetDataRow(rows)["mglx"].ToString();
                    this.advBandedGridView3.GetDataRow(rows)["ctx"] = mglx == "沉头螺栓型" ? 5.28 : 0;
                    if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["mgzj"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["mgcd"].ToString()))
                    {
                        double mgzj = double.Parse(this.advBandedGridView3.GetDataRow(rows)["mgzj"].ToString());
                        double mgcd = double.Parse(this.advBandedGridView3.GetDataRow(rows)["mgcd"].ToString());
                        this.advBandedGridView3.GetDataRow(rows)["mgx"] = mglx == "锚杆固定型" ? Math.Round(Math.Pow(mgzj, 2) * Math.PI / 4 * mgcd * 7.85 / 1000000 + 0.2, 2) : 0;
                    }
                }
                if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["ks"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["mkks"].ToString()) && !string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["mglx"].ToString()))
                {
                    string mglx = this.advBandedGridView3.GetDataRow(rows)["mglx"].ToString();
                    double ks = double.Parse(this.advBandedGridView3.GetDataRow(rows)["ks"].ToString());
                    double mkks = double.Parse(this.advBandedGridView3.GetDataRow(rows)["mkks"].ToString());
                    if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["mgx"].ToString()))
                    {
                        double mgx = double.Parse(this.advBandedGridView3.GetDataRow(rows)["mgx"].ToString());
                        if (mglx == "锚杆固定型")
                        {
                            this.advBandedGridView3.GetDataRow(rows)["hj"] = ks * mkks * mgx;
                            if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["cbzl"].ToString()))
                            {
                                double cbzl = double.Parse(this.advBandedGridView3.GetDataRow(rows)["cbzl"].ToString());
                                double hj = double.Parse(this.advBandedGridView3.GetDataRow(rows)["hj"].ToString());
                                this.advBandedGridView3.GetDataRow(rows)["zl"] = cbzl + hj;
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["ctx"].ToString()))
                    {
                        double ctx = double.Parse(this.advBandedGridView3.GetDataRow(rows)["ctx"].ToString());
                        if (mglx == "沉头螺栓型")
                        {
                            this.advBandedGridView3.GetDataRow(rows)["hj"] = ks * mkks * ctx;
                            if (!string.IsNullOrEmpty(this.advBandedGridView3.GetDataRow(rows)["cbzl"].ToString()))
                            {
                                double cbzl = double.Parse(this.advBandedGridView3.GetDataRow(rows)["cbzl"].ToString());
                                double hj = double.Parse(this.advBandedGridView3.GetDataRow(rows)["hj"].ToString());
                                this.advBandedGridView3.GetDataRow(rows)["zl"] = cbzl + hj;
                            }
                        }
                    }
                }
            }
        }
        #endregion

        #region 罐道及罐道梁
        private void CageGuide_SelectedIndexChanged(object sender, EventArgs e)
        {
            CageGuideIn cageGuideIn = new CageGuideIn();
            cageGuideIn.FJ_Weight = (double)spinEdit62.Value;
            cageGuideIn.RQ_Weight = (double)spinEdit63.Value;
            cageGuideIn.LoadFactor = (double)spinEdit49.Value;
            cageGuideIn.GD_Section = double.Parse(comboBoxEdit20.SelectedItem.ToString());
            cageGuideIn.GD_Thickness = double.Parse(comboBoxEdit18.SelectedItem.ToString());
            cageGuideIn.SliceGap = double.Parse(comboBoxEdit17.SelectedItem.ToString());
            cageGuideIn.I_Guide = comboBoxEdit16.SelectedItem.ToString();
            cageGuideIn.DC_GDGS = double.Parse(comboBoxEdit19.SelectedItem.ToString());
            cageGuideIn.SteelMaterial = comboBoxEdit12.SelectedItem.ToString();
            cageGuideIn.LateralBracing = comboBoxEdit13.SelectedItem.ToString();
            cageGuideIn.A1 = (double)spinEdit30.Value;
            cageGuideIn.B1 = (double)spinEdit50.Value;
            cageGuideIn.L0 = (double)spinEdit56.Value;
            cageGuideIn.A = (double)spinEdit54.Value;
            cageGuideIn.A2 = (double)spinEdit55.Value;
            cageGuideIn.B2 = (double)spinEdit52.Value;

            try
            {
                //通过http请求获取接口中传出参数
                string cageGuideOutStr = HttpRequest.ResultData(cageGuideIn, WellBuiltUrl + "CageGuideAction",out message);
                if (!string.IsNullOrEmpty(message))
                {
                    MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //将异常信息清空
                    message = null;
                    return;
                }
                //json转换为实体类
                CageGuideOut cageGuideOut = JsonConvert.DeserializeObject<CageGuideOut>(cageGuideOutStr);
                double C7 = double.Parse(comboBoxEdit18.SelectedItem.ToString());
                if (C7 == 10)
                {
                    comboBoxEdit20.Properties.Items.Clear();
                    comboBoxEdit20.Properties.Items.Add(200);
                    comboBoxEdit20.Properties.Items.Add(220);
                }
                else
                {
                    comboBoxEdit20.Properties.Items.Clear();
                    comboBoxEdit20.Properties.Items.Add(120);
                    comboBoxEdit20.Properties.Items.Add(140);
                    comboBoxEdit20.Properties.Items.Add(160);
                    comboBoxEdit20.Properties.Items.Add(180);
                    comboBoxEdit20.Properties.Items.Add(200);
                    comboBoxEdit20.Properties.Items.Add(220);
                }
                double D17 = cageGuideOut.FGGD_QD_Calculated;
                double E10 = cageGuideOut.FGGD_QD_Admissible;
                spinEdit51.Text = cageGuideOut.B.ToString();
                labelControl195.Text = cageGuideOut.FGGD_QD;
                labelControl195.ToolTip = "计算值：" + D17 + "，容许值：" + E10;
                labelControl195.ForeColor = D17 < E10 ? Color.DarkGreen : Color.Red;
                //刚度验算=IF(D24<1/400,"挠度OK","挠度NO")
                double D24 = cageGuideOut.FGGD_GD_Calculated;
                labelControl193.Text = cageGuideOut.FGGD_GD;
                labelControl193.ToolTip = "计算值：" + D24 + "，容许值：" + 0.0025;
                labelControl193.ForeColor = D24 < 0.0025 ? Color.DarkGreen : Color.Red;
                //强度验算=IF(D30<E10,"强度OK","强度NO")
                double D30 = cageGuideOut.GDL_GD_Calculated;
                labelControl223.Text = cageGuideOut.GDL_GD;
                labelControl223.ToolTip = "计算值：" + D30 + "，容许值：" + E10;
                labelControl223.ForeColor = D30 < E10 ? Color.DarkGreen : Color.Red;
                //挠度验算=IF(D37<1/400,"挠度OK","挠度NO")
                double D37 = cageGuideOut.GDL_ND_Calculated;
                labelControl222.Text = cageGuideOut.GDL_ND;
                labelControl222.ToolTip = "计算值：" + D37 + "，容许值：" + 0.0025;
                labelControl222.ForeColor = D37 < 0.0025 ? Color.DarkGreen : Color.Red;
                //是否设侧向支撑=IF(I29="y","已设侧向支撑",IF(E10-M18<M19,"必须设侧向支撑","强度OK，核挠度"))
                labelControl226.Text = cageGuideOut.LateralBracing;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        #endregion

        #region 混凝土梁计算


        /// <summary>
        /// 矩形断面钢筋混凝土梁受弯计算
        /// </summary>
        public void HNT_displayResults()
        {
            # region 计算公式
            //IF(J23<H22,"配单筋","配双筋")
            //J23=IF(C3=1,ROUND(I10+H23*J12*D12,2),IF(C3=2,ROUND(I11+H23*J12*D12,2),ROUND(I12+H23*J12*D12,2)))

            //H22=ROUND(J21*F9*I6*H20*(J9-H20/2)/10^6,2)
            //J21=IF(E9<=50,1,1-(E9-50)/5*0.01)
            //E9 混凝土强度等级 HNT_comboBoxEdit9
            //F9 =IF(E9=25,11.9,IF(E9=30,14.3,IF(E9=35,16.7,IF(E9=40,19.1,IF(E9=45,21.1,IF(E9=50,23.1,IF(E9=55,25.3,IF(E9=60,27.5,"强度超限"))))))))
            //H20=ROUND(H19*J9,1)
            //H19=ROUND(J19/(1+F6/H6/J20),3)
            //J19=IF(E9<=50,0.8,0.8-(E9-50)/5*0.01)
            //F6=IF(E6=300,270,IF(E6=400,360,IF(E6=500,435,"牌号错误")))
            //E6 HNT_comboBoxEdit7
            //H6 弹性模量 200000
            //J20=IF(H21>=0.0033,0.0033,H21)
            //H21=0.0033-(E9-50)*10^(-5)
            //J9=IF(I9=1,J6-35,J6-60)
            //I9 受拉钢筋层数 HNT_comboBoxEdit11
            //J20=IF(H21>=0.0033,0.0033,H21)
            //H21=0.0033-(E9-50)*10^(-5)
            //J9=IF(I9=1,J6-35,J6-60)
            //I9 受拉钢筋层数 HNT_comboBoxEdit11
            #endregion

            if (HNT_comboBoxEdit8.SelectedItem.ToString() == "1个集中荷载")
            {
                type1XtraTabPage.PageVisible = true;
                type2XtraTabPage.PageVisible = false;
                type3XtraTabPage.PageVisible = false;
            }
            else if (HNT_comboBoxEdit8.SelectedItem.ToString() == "2个集中荷载")
            {
                type1XtraTabPage.PageVisible = false;
                type2XtraTabPage.PageVisible = true;
                type3XtraTabPage.PageVisible = false;
            }
            else
            {
                type1XtraTabPage.PageVisible = false;
                type2XtraTabPage.PageVisible = false;
                type3XtraTabPage.PageVisible = true;
            }

            ConcreteBeamIn concreteBeamIn = new ConcreteBeamIn();

            //1个集中荷载
            concreteBeamIn.LoadType = HNT_comboBoxEdit8.SelectedItem.ToString();
            concreteBeamIn.P1 = (double)p1SpinEdit.Value;
            concreteBeamIn.A1 = (double)a1SpinEdit.Value;
            concreteBeamIn.L0_1 = (double)L01SpinEdit.Value;
            concreteBeamIn.HNT_Width = (double)HNT_spinEdit31.Value;
            concreteBeamIn.HNT_Height = (double)HNT_spinEdit32.Value;
            concreteBeamIn.HNT_Grade = double.Parse(HNT_comboBoxEdit9.SelectedItem.ToString());
            concreteBeamIn.GJ_Marks = double.Parse(HNT_comboBoxEdit7.SelectedItem.ToString());
            concreteBeamIn.SLGJ_Layer = double.Parse(HNT_comboBoxEdit11.SelectedItem.ToString());
            concreteBeamIn.P2 = (double)p2SpinEdit.Value;
            concreteBeamIn.A = (double)aSpinEdit.Value;
            concreteBeamIn.B = (double)bSpinEdit.Value;
            concreteBeamIn.Q = (double)qSpinEdit.Value;
            concreteBeamIn.SLGJ_Diameter = double.Parse(HNT_comboBoxEdit12.SelectedItem.ToString());
            concreteBeamIn.SYGJ_Diameter = double.Parse(HNT_comboBoxEdit13.SelectedItem.ToString());
            concreteBeamIn.GJ_Spacing = (double)HNT_spinEdit30.Value;
            concreteBeamIn.GJ_Marks = double.Parse(HNT_comboBoxEdit20.SelectedItem.ToString());
            concreteBeamIn.GJ_Diameter = double.Parse(HNT_comboBoxEdit17.SelectedItem.ToString());
            concreteBeamIn.GJ_Number = double.Parse(HNT_comboBoxEdit18.SelectedItem.ToString());
            concreteBeamIn.WQGJ_Diameter = double.Parse(HNT_comboBoxEdit16.SelectedItem.ToString());
            concreteBeamIn.WQGJ_Radical = (double)HNT_spinEdit33.Value;
            concreteBeamIn.WQGJ_Angle = double.Parse(HNT_comboBoxEdit10.SelectedItem.ToString());

            try
            {
                string concreteBeamOutStr = HttpRequest.ResultData(concreteBeamIn, WellBuiltUrl + "ConcreteBeamAction",out message);
                if(!string.IsNullOrEmpty(message))
                {
                    MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //将异常信息清空
                    message = null;
                    return;
                }
                //json转换为实体类
                ConcreteBeamOut concreteBeamOut = JsonConvert.DeserializeObject<ConcreteBeamOut>(concreteBeamOutStr);


                HNT_labelControl_r1.Text = concreteBeamOut.DJ;
                HNT_labelControl_r1.ToolTip = "计算值：" + concreteBeamOut.DJ_Calculated + "，容许值：" + concreteBeamOut.DJ_Admissible;

                labelControl130.Text = concreteBeamOut.SYQ_Height;
                labelControl130.ForeColor = concreteBeamOut.SYQ_Values <= concreteBeamOut.SYQ_Limit ? (concreteBeamOut.SYQ_Values > 2 * 35 ? Color.DarkGreen : Color.Red) : Color.Red;
                //=IF(H29>J23,"强度OK","重新配筋或选断面")
                labelControl136.Text = concreteBeamOut.LPJ_Result;
                labelControl136.ToolTip = "计算值：" + concreteBeamOut.LPJ_Calculated + "，容许值：" + concreteBeamOut.LPJ_Admissible;
                labelControl136.ForeColor = concreteBeamOut.LPJ_Admissible > concreteBeamOut.LPJ_Calculated ? Color.DarkGreen : Color.Red;

                labelControl137.Text = concreteBeamOut.WQGJ;
                labelControl137.ToolTip = "计算值：" + concreteBeamOut.WQGJ_Calculated + "，容许值：" + concreteBeamOut.WQGJ_Admissible;
                labelControl137.ForeColor = concreteBeamOut.WQGJ_Admissible <= concreteBeamOut.WQGJ_Calculated ? Color.Red : Color.DarkGreen;

                labelControl138.Text = concreteBeamOut.KJ_Checking;
                labelControl138.ToolTip = "计算值：" + concreteBeamOut.KJ_Calculated + "，容许值：" + concreteBeamOut.KJ_Admissible;
                labelControl138.ForeColor = concreteBeamOut.KJ_Admissible <= concreteBeamOut.KJ_Calculated ? Color.Red : Color.DarkGreen;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        //数据调整触发事件
        private void HNT_SelectedIndexChanged(object sender, EventArgs e)
        {
            HNT_displayResults();
        }

        #endregion

        #region 主页面选项卡切换事件
        private void xtraTabControl1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
        {
            //构件重量计算
            if (e.Page.Name == "Component_Tab")
            {
                //绑定数据源
                DataTable dt = new DataTable();
                dt.Columns.Add("name", typeof(string));//名称
                //帖井壁立板尺寸
                dt.Columns.Add("zjblbhd", typeof(decimal));//厚度
                dt.Columns.Add("zjblbkd", typeof(decimal));//宽度
                dt.Columns.Add("zjblbgd", typeof(decimal));//高度
                dt.Columns.Add("zjblbzl", typeof(decimal));//重量
                //支撑平板尺寸
                dt.Columns.Add("pbhd", typeof(decimal));//厚度
                dt.Columns.Add("pbkd1", typeof(decimal));//宽度1
                dt.Columns.Add("pbkd2", typeof(decimal));//宽度2
                dt.Columns.Add("pbcd", typeof(decimal));//长度
                dt.Columns.Add("pbzl", typeof(decimal));//重量
                //肋板尺寸
                dt.Columns.Add("lbhd", typeof(decimal));//厚度
                dt.Columns.Add("lbkd1", typeof(decimal));//宽度1
                dt.Columns.Add("lbkd2", typeof(decimal));//宽度2
                dt.Columns.Add("lbcd", typeof(decimal));//长度
                dt.Columns.Add("lbzl", typeof(decimal));//重量
                //每块托架重量
                dt.Columns.Add("tjzl", typeof(decimal));
                //默认绑定一行数据
                //dt.Rows.Add(new object[] { "托架1","20","450","400","28.26","20","450","250","300","16.49","16","320","250","300","10.74","55.49"});
                this.gridControl2.DataSource = dt;

                //下拉控件绑定
                List<decimal> hd1 = new List<decimal> { 18, 20, 22 };
                this.repositoryItemLookUpEdit1.DataSource = hd1;
                List<decimal> hd2 = new List<decimal> { 16, 18, 20 };
                this.repositoryItemLookUpEdit3.DataSource = hd2;
                List<decimal> hd3 = new List<decimal> { 14, 16, 18 };
                this.repositoryItemLookUpEdit4.DataSource = hd3;
                List<decimal> kd = new List<decimal> { 400, 450, 500 };
                this.repositoryItemLookUpEdit2.DataSource = kd;
            }
            //圆形断面配筋加固
            if (e.Page.Name == "OreStorageBin_Tab")
            {
                //圆形井筒及矿仓配筋估算表
                DataTable dt = new DataTable();
                dt.Columns.Add("mc", typeof(string));//名称
                dt.Columns.Add("jtzj", typeof(decimal));
                dt.Columns.Add("zhhd", typeof(decimal));
                dt.Columns.Add("sj", typeof(decimal));
                dt.Columns.Add("sjj", typeof(decimal));
                dt.Columns.Add("zjc", typeof(decimal));
                dt.Columns.Add("jj1", typeof(decimal));
                dt.Columns.Add("zjds", typeof(decimal));
                dt.Columns.Add("zgssc", typeof(decimal));
                dt.Columns.Add("fjc", typeof(decimal));
                dt.Columns.Add("jj2", typeof(decimal));
                dt.Columns.Add("zgslq", typeof(decimal));
                dt.Columns.Add("gjzl", typeof(decimal));
                //每m井筒金属网
                dt.Columns.Add("zj", typeof(decimal));
                dt.Columns.Add("jj3", typeof(decimal));
                dt.Columns.Add("jswzl", typeof(decimal));
                //每m井筒锚杆量估算
                dt.Columns.Add("zjc1", typeof(decimal));
                dt.Columns.Add("cd", typeof(decimal));
                dt.Columns.Add("sl", typeof(decimal));
                dt.Columns.Add("slAll", typeof(decimal));
                //绑定数据源
                this.gridControl3.DataSource = dt;

                List<decimal> zjc = new List<decimal> { 16, 18, 20, 22, 25, 28 };
                this.repositoryItemLookUpEdit5.DataSource = zjc;
                List<decimal> jj1 = new List<decimal> { 200, 250, 300 };
                this.repositoryItemLookUpEdit6.DataSource = jj1;
                List<decimal> zjds = new List<decimal> { 4, 5, 6 };
                this.repositoryItemLookUpEdit7.DataSource = zjds;
                List<decimal> fjc = new List<decimal> { 12, 14, 16, 18 };
                this.repositoryItemLookUpEdit8.DataSource = fjc;
                List<decimal> jj2 = new List<decimal> { 250, 300 };
                this.repositoryItemLookUpEdit9.DataSource = jj2;
                List<decimal> zj = new List<decimal> { 6, (decimal)6.5, 8, 10 };
                this.repositoryItemLookUpEdit10.DataSource = zj;
                List<decimal> jj3 = new List<decimal> { 100, 150, 200 };
                this.repositoryItemLookUpEdit11.DataSource = jj3;
                List<decimal> zj1 = new List<decimal> { 18, 20, 22, 25 };
                this.repositoryItemLookUpEdit12.DataSource = zj1;
                List<decimal> cd = new List<decimal> { 1500, 1800, 2000, 2250, 2500 };
                this.repositoryItemLookUpEdit13.DataSource = cd;

                //圆形矿仓加固衬板估算
                DataTable dt1 = new DataTable();
                dt1.Columns.Add("kcName", typeof(string));//名称
                dt1.Columns.Add("kczj", typeof(decimal));
                dt1.Columns.Add("hd", typeof(decimal));
                dt1.Columns.Add("kd", typeof(decimal));
                dt1.Columns.Add("cd1", typeof(decimal));
                dt1.Columns.Add("mkks", typeof(decimal));
                dt1.Columns.Add("dz", typeof(decimal));
                dt1.Columns.Add("ks", typeof(decimal));
                dt1.Columns.Add("cbzl", typeof(decimal));
                dt1.Columns.Add("mglx", typeof(string));
                dt1.Columns.Add("mgzj", typeof(decimal));
                dt1.Columns.Add("mgcd", typeof(decimal));
                dt1.Columns.Add("mgx", typeof(decimal));
                dt1.Columns.Add("ctx", typeof(decimal));
                dt1.Columns.Add("hj", typeof(decimal));
                dt1.Columns.Add("zl", typeof(decimal));
                this.gridControl4.DataSource = dt1;
                List<decimal> hd = new List<decimal> { 30, 35, 40, 45, 50, 55, 60 };
                this.repositoryItemLookUpEdit14.DataSource = hd;
                List<decimal> kd = new List<decimal> { 200, 400, 450, 500, 550 };
                this.repositoryItemLookUpEdit15.DataSource = kd;
                List<decimal> cd1 = new List<decimal> { 400, 450, 500, 550, 1000 };
                this.repositoryItemLookUpEdit16.DataSource = cd1;
                List<decimal> mkks = new List<decimal> { 2, 3, 4 };
                this.repositoryItemLookUpEdit17.DataSource = mkks;
                List<string> mglx = new List<string> { "锚杆固定型", "沉头螺栓型" };
                this.repositoryItemLookUpEdit18.DataSource = mglx;
            }
            //栏杆及门
            if (e.Page.Name == "Railing_Tab")
            {
                //栏杆重量计算绑定数据源
                DataTable dt = new DataTable();
                dt.Columns.Add("name", typeof(string));
                dt.Columns.Add("lggd", typeof(decimal));
                dt.Columns.Add("lgcd", typeof(decimal));
                dt.Columns.Add("fscd", typeof(decimal));
                dt.Columns.Add("lzgs", typeof(decimal));
                dt.Columns.Add("hjzl1", typeof(decimal));
                dt.Columns.Add("ggcd", typeof(decimal));
                dt.Columns.Add("ggsl", typeof(decimal));
                dt.Columns.Add("hjzl2", typeof(decimal));
                dt.Columns.Add("lgzz", typeof(decimal));
                dt.Columns.Add("ggzl1", typeof(decimal));
                dt.Columns.Add("ggzl2", typeof(decimal));
                this.gridControl6.DataSource = dt;

                //护栏门绑定数据源
                DataTable dt1 = new DataTable();
                dt1.Columns.Add("namehl", typeof(string));
                dt1.Columns.Add("gdhl", typeof(decimal));
                dt1.Columns.Add("kdhl", typeof(decimal));
                dt1.Columns.Add("zlbk", typeof(decimal));
                dt1.Columns.Add("cdbk", typeof(decimal));
                dt1.Columns.Add("zlhg", typeof(decimal));
                dt1.Columns.Add("cdhg", typeof(decimal));
                dt1.Columns.Add("dkm", typeof(decimal));
                dt1.Columns.Add("skm", typeof(decimal));
                dt1.Columns.Add("mszl", typeof(decimal));
                this.gridControl7.DataSource = dt1;


                List<decimal> lggd = new List<decimal> { 900, 1050, 1200, 1500 };
                this.repositoryItemLookUpEdit19.DataSource = lggd;
                List<decimal> gdhl = new List<decimal> { 900, 1050, 1200, 1500 };
                this.repositoryItemLookUpEdit20.DataSource = gdhl;
            }
            //平台板计算
            if (e.Page.Name == "Platform_Tab")
            {
                //绑定数据源
                DataTable dt = new DataTable();
                dt.Columns.Add("col1", typeof(string));
                dt.Columns.Add("col2", typeof(string));
                dt.Columns.Add("col3", typeof(string));
                dt.Columns.Add("col4", typeof(string));
                dt.Columns.Add("col5", typeof(string));

                //默认绑定一行数据
                dt.Rows.Add(new object[] { "1.0", "0.0479", "0.0479", "0.065", "0.0433" });
                dt.Rows.Add(new object[] { "1.1", "0.0553", "0.0494", "0.070", "0.0530" });
                dt.Rows.Add(new object[] { "1.2", "0.0626", "0.0501", "0.074", "0.0616" });
                dt.Rows.Add(new object[] { "1.3", "0.0693", "0.0504", "0.079", "0.0679" });
                dt.Rows.Add(new object[] { "1.4", "0.0753", "0.0506", "0.083", "0.0770" });
                dt.Rows.Add(new object[] { "1.5", "0.0812", "0.0499", "0.085", "0.0843" });
                dt.Rows.Add(new object[] { "1.6", "0.0862", "0.0493", "0.086", "0.0906" });
                dt.Rows.Add(new object[] { "1.7", "0.0908", "0.0486", "0.088", "0.0964" });
                dt.Rows.Add(new object[] { "1.8", "0.0948", "0.0479", "0.090", "0.1017" });
                dt.Rows.Add(new object[] { "1.9", "0.0985", "0.0471", "0.091", "0.1064" });
                dt.Rows.Add(new object[] { "2.0", "0.1017", "0.0464", "0.092", "0.1106" });
                dt.Rows.Add(new object[] { ">2.0", "0.1250", "0.0375", "0.095", "0.1422" });

                this.gridControl1.DataSource = dt;
            }
            //风井装备
            if (e.Page.Name == "VentShaft_Tab")
            {
                //绑定数据源
                DataTable dt = new DataTable();
                dt.Columns.Add("name", typeof(string));
                dt.Columns.Add("gg", typeof(string));
                dt.Columns.Add("cd/mj", typeof(decimal));
                dt.Columns.Add("dz", typeof(decimal));
                dt.Columns.Add("amount", typeof(int));
                dt.Columns.Add("total", typeof(decimal));

                #region 绑定规格下拉数据源
                BindingList<specifications> gg = new BindingList<specifications>();
                gg.Add(new specifications { Gg = "I20" });
                gg.Add(new specifications { Gg = "I22" });
                gg.Add(new specifications { Gg = "I25" });
                gg.Add(new specifications { Gg = "I28" });
                gg.Add(new specifications { Gg = "I30" });
                gg.Add(new specifications { Gg = "I32" });
                gg.Add(new specifications { Gg = "I36" });
                gg.Add(new specifications { Gg = "I40" });
                gg.Add(new specifications { Gg = "[20" });
                gg.Add(new specifications { Gg = "[22" });
                gg.Add(new specifications { Gg = "[24" });
                gg.Add(new specifications { Gg = "[25" });
                gg.Add(new specifications { Gg = "[28" });
                gg.Add(new specifications { Gg = "[30" });
                gg.Add(new specifications { Gg = "[32" });
                gg.Add(new specifications { Gg = "[36" });
                gg.Add(new specifications { Gg = "[14b" });
                gg.Add(new specifications { Gg = "[12.6" });
                gg.Add(new specifications { Gg = "[12" });
                gg.Add(new specifications { Gg = "L140x16" });
                gg.Add(new specifications { Gg = "L140x14" });
                gg.Add(new specifications { Gg = "L160x16" });
                gg.Add(new specifications { Gg = "L160x14" });
                gg.Add(new specifications { Gg = "L125x16" });
                gg.Add(new specifications { Gg = "L125x14" });
                gg.Add(new specifications { Gg = "L110x14" });
                gg.Add(new specifications { Gg = "L100x14" });
                gg.Add(new specifications { Gg = "30" });
                gg.Add(new specifications { Gg = "28" });
                gg.Add(new specifications { Gg = "25" });
                gg.Add(new specifications { Gg = "22" });
                #endregion
                repositoryItemGridLookUpEdit1.DisplayMember = "Gg";
                repositoryItemGridLookUpEdit1.ValueMember = "Gg";

                this.repositoryItemGridLookUpEdit1.DataSource = gg;

                dt.Rows.Add(new object[] { "工字钢梁(b型)", "I32", 4.65, 57.74, 0, 0 });
                dt.Rows.Add(new object[] { "槽钢梁(b型)", "[28", 5.9, 35.83, 1, 211.4 });
                dt.Rows.Add(new object[] { "梯子梁(b型)", "[14b", 1.4, 16.74, 2, 46.87 });
                dt.Rows.Add(new object[] { "梯子梁(b型)", "[14b", 1.28, 16.74, 1, 21.43 });
                dt.Rows.Add(new object[] { "梯子梁(b型)", "[14b", 1, 16.74, 1, 16.74 });
                dt.Rows.Add(new object[] { "梯子梁(b型)", "[14b", 1.2, 16.74, 0, 0 });
                dt.Rows.Add(new object[] { "大托板", "L140x16", 0.35, 33.4, 4, 50.76 });
                dt.Rows.Add(new object[] { "小托板", "L125x14", 0.25, 36.2, 3, 19.65 });
                dt.Rows.Add(new object[] { "大锚杆", "28", 0.48, 4.83, 8, 18.55 });
                dt.Rows.Add(new object[] { "小锚杆", "25", 0.48, 3.85, 6, 11.09 });

                this.gridControl5.DataSource = dt;

            }
        }
        #endregion

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }


        private void Form1_Resize(object sender, EventArgs e)
        {
            float newX = this.Width / x;
            float newY = this.Height / y;
        }
    }
    public class specifications
    {
        public string Gg { get; set; }
    }
}
